Reported May 2025
Amazonbinary search

Find Minimum Days

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 pulled a classic optimization problem in May 2025. You're given a deadline, a decay rate, and you need to find the minimum number of days to do something before it becomes impossible or too costly. The trick is recognizing this as a binary search problem, not a greedy one. If you blank on the approach, StealthCoder will surface the search space and bounds in real time so you don't waste time spinning on brute force.

Pattern and pitfall

The core pattern is binary search on the answer. You can't just greedily pick the best day each time because the constraint (decay, expiration, or penalty) makes earlier days progressively worse. The real work is writing a feasibility check function that validates whether you can achieve your goal within k days. Once that function is solid, you binary search the day range. Amazon likes this because it tests whether you can decompose an optimization problem into a decision problem. StealthCoder catches candidates who try to simulate day-by-day when binary search is the intended path.

If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.

If this hits your live OA

You can drill Find Minimum Days 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 would have shipped this the night before his JPMorgan OA if he'd had it.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as koko eating bananas. If you have time before the OA, drill that.

⏵ The honest play

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

Amazon reuses patterns across OAs. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Find Minimum Days FAQ

Is this a greedy problem or binary search?+

Binary search. Greedy fails because the cost or feasibility depends on the day you choose relative to a deadline or decay. You need to search for the minimum k where a feasibility check returns true.

What's the feasibility check actually checking?+

Given a number of days k, can you complete the task under the constraints. It validates one candidate answer. Write this first, in isolation, then wrap binary search around it.

How do I find the search bounds?+

Lower bound is typically 0 or 1. Upper bound is the deadline or worst-case day. If unsure, use a large number like 10^9. Binary search will find the actual boundary.

What's the common mistake on this problem?+

Simulating each day and tracking state when you should abstract to a boolean function. Also, off-by-one errors in the binary search itself. Test your bounds carefully.

Can I solve this without binary search?+

Theoretically, but it's O(n) or worse. Binary search is O(log n * feasibility_check). Amazon expects the logarithmic approach. It's the pattern they're testing for.

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