Reported March 2025
Amazongreedy

Get Minimal Cost

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 'Get Minimal Cost' question hit candidates in March 2025, and it's a straightforward optimization puzzle that looks easier than it plays. You're given some kind of cost structure, and you need to find the minimum. No fancy data structures required, but the trap is misreading the constraints or bruteforcing when a greedy or math-based trick saves you instantly. StealthCoder will flag the pattern in seconds if you blank on the approach during the live assessment.

Pattern and pitfall

Without the exact problem text, the likely pattern is either greedy (pick the cheapest option at each step) or a math formula (sum costs, apply a discount rule, minimize). The common pitfall: candidates try to generate all combinations when the problem has a closed-form solution or a single greedy choice. Amazon loves cost-optimization questions because they care about infrastructure efficiency. During the OA, if you're stuck, the hedge is to code a brute-force solution fast (works for small inputs) while your mind catches the optimization. StealthCoder can provide both the safe slow version and the fast pattern.

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 Get Minimal Cost 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.

Get Minimal Cost FAQ

Is this a dynamic programming problem?+

Unlikely. DP is overkill here. It's probably greedy (pick min at each step) or math (formula-based). If there's overlapping subproblems, it's DP, but test greedy and formulas first. You'll know in minutes.

What's the main trick Amazon looks for?+

Recognizing that you don't need to explore all options. Either sort and pick greedily, or derive a formula. Read the constraints carefully: do they hint at a polynomial solution?

How do I avoid the common pitfall?+

Don't assume you need recursion or backtracking. Reread the problem twice for discount rules, bulk pricing, or tiered costs. These hide the greedy choice. Write pseudocode before coding.

What if I can't figure out the pattern in 10 minutes?+

Code a brute-force solution that explores all states and returns the min. It'll pass small tests. That buys you time and points while you think about the optimization.

Is this question asked often at Amazon?+

Yes. Cost and resource optimization is Amazon's bread and butter. This problem style (minimize something) shows up repeatedly. Greedy and math patterns are worth knowing cold.

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