Maximize Points
Reported by candidates from Google's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
Google's November OA threw up a points-maximization problem with no clear greedy path. You're looking at a game or sequence where you pick moves to rack up points, and the naive choice backfires. The trick is almost always dynamic programming or recursion with memoization, not a sorting hack. If you blank during the OA, StealthCoder will spot the DP state and the recurrence relation so you don't crater on a problem you've seen the shape of before.
Pattern and pitfall
Maximize Points problems usually pivot on two things: identifying what state matters (position, count, remaining resource) and recognizing that a greedy choice now can tank your total score later. Most candidates start by picking the highest-value thing available, then hit a test case and realize they painted themselves into a corner. The winning move is DP: for each state, compute the best outcome by trying all legal choices and picking the one that yields the max. Memoization keeps you from recalculating the same state twice. When you're live and your first approach bombs, StealthCoder will help you spot whether you need DP, a different state definition, or a constraint you missed.
If you see this problem in your OA tomorrow, the play is to recognize the pattern in 30 seconds. StealthCoder buys you that recognition.
You can drill Maximize Points cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken.
Get StealthCoderRelated leaked OAs
This OA pattern shows up on LeetCode as house robber. If you have time before the OA, drill that.
You've seen the question.
Make sure you actually pass Google's OA.
Google reuses patterns across OAs. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Maximize Points FAQ
Is this a greedy problem or DP?+
Greedy fails on these almost always. The optimal choice right now isn't the one that looks best. Use DP: define a recursive function for the max points from a given state, memoize it, and try all legal moves at each step. Greedy is a trap.
What's the most common state definition for a points problem?+
Usually it's your current position or how many moves you've made or what resources you have left. Sometimes it's a bitmask if the problem is small. Read carefully: the state is whatever changes your future choices. If you can't identify it, you're not yet clear on what the problem is asking.
How do I know if I need a 1D or 2D DP table?+
1D: one parameter changes (like position in a string or array). 2D: two parameters matter (like position plus a count or remaining budget). If you have more than two independent parameters, consider a hash map instead of a table.
What's the biggest pitfall on maximize problems at Google?+
Misunderstanding the constraint or the scoring rule. Re-read the problem three times. Google often hides a detail that breaks greedy. If your logic is sound but test cases fail, the rule definition is probably off.
Can I solve this in 48 hours if I've never done DP?+
Not from scratch, but you can pattern-match. Write out a brute-force recursive solution that tries all moves at each step, return the max, then add memoization. That's 80% of DP problems. You don't need to be a DP theorist; you need to recognize the shape.