Reported December 2024
Amazondynamic programming

Calculate Max Quality Score

Reported by candidates from Amazon's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Amazon OA. Under 2s to a working solution.
Founder's read

Amazon's December 2024 OA includes a max quality score problem that catches candidates off-guard because the optimization isn't obvious from the problem statement alone. You're likely given a set of items or transactions with quality attributes, and you need to maximize some aggregate score under constraints. The trap is assuming a greedy approach works when you actually need dynamic programming or careful case analysis. StealthCoder runs invisibly during your OA and can feed you the pattern in real time if you hit a wall on implementation.

Pattern and pitfall

This problem hinges on understanding what 'quality' means in context and how constraints bind your choices. Most candidates jump to greedy (pick the highest quality item) and fail test cases where the global optimum requires trading off one high-quality item for multiple medium-quality ones, or respecting some hidden dependency. The real pattern often involves dynamic programming on item selection or a prefix/suffix optimization to avoid recalculating scores. Common pitfall: not recognizing that the quality function itself might be non-linear (e.g., product of qualities vs. sum, or penalties for imbalance). Write out what the scoring rule is before coding. StealthCoder handles the live uncertainty, but nailing the score function first saves you.

StealthCoder is the hedge for the one pattern you didn't drill. It runs invisibly during the screen share.

If this hits your live OA

You can drill Calculate Max Quality Score 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. If you're reading this with an OA window open, you're who this was built for.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Amazon's OA.

Amazon reuses patterns across OAs. If you're reading this with an OA window open, you're who this was built for. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Calculate Max Quality Score FAQ

Is this a DP problem or can greedy work?+

Neither is guaranteed. First clarify the constraint and scoring rule. If you maximize by simply picking items in a greedy order, you'll fail cases where order or subset composition matters. DP is safer if item dependencies exist. Test greedy on small examples first.

How do I figure out the quality function if it's vague?+

The problem statement has examples. Work backward from the expected output. Is quality the sum of item scores, product, or something conditional. Write down the formula explicitly before coding. A wrong formula is the #1 reason for WA here.

What if I can't optimize fast enough?+

Check constraints. If n is under 100, DP is fine. If n is 10^5+, you need greedy or a math trick. Amazon often hides a mathematical insight (like sorting by a derived ratio) that makes greedy work. Look for it before brute-forcing.

How much time should I spend on this live?+

Spend 5-10 minutes understanding the problem and writing out the scoring rule. If you're not sure of the pattern by then, code a brute-force DP solution first. You can optimize later. Partial credit is real.

Is this still asked at Amazon in late 2024?+

Yes, as of December 2024 it's in rotation. Variations on score optimization under constraints are common in Amazon OAs. The specific constraints change, but the pattern of misunderstanding the objective function remains a top failure mode.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Amazon.

OA at Amazon?
Invisible during screen share
Get it