Get Min Time
Reported by candidates from ThoughtSpot's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
ThoughtSpot reported this optimization problem in March 2024, and it's a trap if you think brute force first. You're given a scenario where you need to minimize some time metric, likely across multiple tasks or resources. The candidates who blanked tried greedy or recursive approaches before realizing the real trick: binary search on the answer space. StealthCoder is your safety net if the optimization pattern doesn't click in the moment. You have maybe 45 minutes to lock this down.
Pattern and pitfall
Get Min Time is a classic binary search on answer problem, not a straightforward simulation. The pattern: you can't compute the minimum time directly, but you can check if a given time T is achievable. Binary search the answer space from 0 to some upper bound, and for each candidate time, validate feasibility in O(n) or O(n log n). The pit: candidates write nested loops or try to greedily assign resources, which either times out or misses the optimal cut. The real solution is usually O(n log(max_time)) or similar. When you're live and stuck on the feasibility check, StealthCoder will show you the validation logic fast so you can code the binary search wrapper without panic.
If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.
You can drill Get Min Time 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 StealthCoderThis OA pattern shows up on LeetCode as magnetic force between two balls. If you have time before the OA, drill that.
You've seen the question.
Make sure you actually pass ThoughtSpot's OA.
ThoughtSpot 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.
Get Min Time FAQ
Is this a greedy problem or a search problem?+
It's binary search on the answer. Greedy won't work because the optimal solution isn't the sum of local optima. You need to search the space of possible times and test feasibility for each.
What's the feasibility check usually look like?+
Given a time limit T, simulate or count whether you can complete all tasks/operations within T. Often involves checking resource usage, task sequencing, or parallel execution. This check runs once per binary search iteration.
How do I know the upper bound for binary search?+
Usually sum of all individual task times, or worst-case single-threaded execution. Check the problem constraints. If you're unsure, use a large value like 10^9. Binary search tolerates loose bounds.
What mistakes did other candidates make?+
Trying greedy assignment, writing O(n^2) nested loops, or not recognizing the binary search pattern at all. Some wasted time on priority queues when the problem didn't need one. Spot the 'minimize' keyword early.
Can I prepare for this in 24 hours?+
Yes. Review binary search on answers (not on array indices). Practice one problem like 'Magnetic Force Between Two Balls' or 'Minimum Time to Eat All Grains'. The pattern is standard. Nail the feasibility check and the rest flows.