Find Min Time Required
Reported by candidates from Amazon's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
Amazon's October OA included a timing optimization problem with no obvious brute-force path. You're given tasks or operations with dependencies and constraints, and you need to find the minimum time to complete everything. The trap: candidates overthink it and write nested loops when the answer lives in binary search or greedy ordering. If you blank during the live OA, StealthCoder will read the exact constraints and surface the right approach in real time.
Pattern and pitfall
This is a classic min-time optimization wrapped in a systems problem. The pattern is almost always binary search on the answer space, or greedy reordering with a priority queue. You set a time T and ask: can I finish all tasks by time T? Then you binary search for the smallest T that works. The common miss: forgetting that dependencies matter, or treating tasks as independent when they're not. The hidden layer: sometimes it's about parallel execution (threads, workers, servers) and you need to allocate greedily. Run through the constraints first. If the answer range is huge (1 to 10^9), that's your binary search hint. StealthCoder catches the minute you misread parallelism vs sequential, so use it if you stall on setup.
If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.
You can drill Find Min Time Required 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 StealthCoderRelated leaked OAs
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 Min Time Required FAQ
Is this really a binary search problem?+
Probably yes if the time range is large. If you can answer 'can I do this in T minutes' in O(n) or O(n log n), then binary search the answer. That's the standard Amazon pattern for min-time OAs.
What if there are worker constraints, like 'k servers' or 'one CPU'?+
Greedy assignment with a min-heap. Sort tasks by some criteria (deadline, duration, dependency count), then assign each to the worker finishing soonest. Amazon loves this variant. Simulate the assignment, track completion times.
How do I handle task dependencies?+
Topological sort first if the graph is explicit. Then calculate the critical path or use dynamic programming on finish times. A task can't start until all predecessors finish. Ignore that and your answer fails immediately.
Should I prepare a specific solution, or just know the pattern?+
Know the pattern and skeleton code. Binary search on answer, inner check function, greedy heap for assignment. In 24 hours, memorize the template and one worked example. The exact inputs might differ but the frame won't.
What's the most common bug?+
Off-by-one in the binary search, or forgetting that a task with duration 5 starting at time 2 finishes at time 7, not time 5. Trace through a small example by hand before you code. Amazon will test that edge case.