Reported January 2024
Amazongreedy

Get Min Cost Data

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 Min Cost Data' showed up in January 2024 assessments, and it's testing whether you can spot the greedy pattern under pressure. You're being asked to minimize cost across some set of choices, which sounds simple until you realize the order of operations matters. This is exactly the kind of problem where one wrong assumption tanks your solution. StealthCoder sits invisible during your OA and can feed you the greedy trick in real time if you freeze on the approach.

Pattern and pitfall

Greedy problems on Amazon assessments almost always hinge on sorting or selecting items in a specific order to get the globally optimal result. 'Min cost' signals you're likely picking items, scheduling them, or combining them in a way that minimizes total expense. The trap: candidates try dynamic programming or brute force when a single pass with the right sort order solves it instantly. The pattern is almost always 'sort by some property, then greedily pick the best available choice at each step.' Your job in the live OA is to identify what to sort by (cost, ratio, count, frequency) and prove that greedy choice never leads you into a worse local state. If you blank on the proof, StealthCoder gives you the confidence to code the greedy solution and move on.

The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.

If this hits your live OA

You can drill Get Min Cost Data 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 for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play.

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. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Get Min Cost Data FAQ

Is this actually a greedy problem or will I need DP?+

Amazon labeled it greedy for a reason. If you find yourself writing a DP table or exploring exponential branches, stop and re-sort your data. The right greedy solution should run in O(n log n) or O(n). If your code is O(2^n), you're off track.

What's the most common sorting mistake on this type of problem?+

Sorting only by one dimension when the answer needs you to sort by cost, then by a secondary attribute (like quantity or rate). Read the problem twice. Identify what 'cost' means in context. It might not be a single number.

How do I prove my greedy choice is optimal in the interview?+

Show that once you've sorted, picking the best option now can never block a better future choice. Walk through a small example on the whiteboard. Say 'I'm picking the lowest cost first because future picks remain valid.' Simple proof beats hand-waving.

Can I brute force this in 45 minutes if I don't see the greedy angle?+

No. Amazon's time limits are tight. If greedy is the pattern and you code brute force, you'll time out. Use the first 10 minutes to identify the sort order. If stuck, that's when you really need a hedge like StealthCoder.

Does Amazon still ask greedy problems on January OAs?+

Yes. This was reported live in January 2024. Greedy is a core Amazon pattern for resource allocation and cost minimization. Expect it. Get comfortable with sorting and the logic of local optimality implying global optimality.

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