Reported September 2024
JP Morgangreedy

Get Min Machines

Reported by candidates from JP Morgan's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live JP Morgan OA. Under 2s to a working solution.
Founder's read

JP Morgan's "Get Min Machines" hits candidates in September with a resource allocation puzzle. You're given task execution windows and need to find the minimum number of machines required to process all tasks without overlap. It's not a graph problem or dynamic programming trap. It's a greedy scheduling problem hiding in plain sight. StealthCoder helps you recognize the pattern fast if you freeze mid-interview, giving you the algorithmic scaffold to finish strong.

Pattern and pitfall

The core trick: sort tasks by start time, then use a min-heap (priority queue) to track when each machine becomes free. For each task, check if the machine that finishes earliest is available before the current task starts. If yes, reuse it. If no, allocate a new machine. The heap tracks finish times, not machine IDs. Most candidates over-engineer this as an assignment problem or try interval merging. The greedy approach is O(n log n) and runs clean. StealthCoder can whisper the heap structure if you blank on the state management, so you don't lose points on implementation syntax.

Memorize the pattern. If you can't, run StealthCoder. The proctor sees the IDE. They don't see what's behind it.

If this hits your live OA

You can drill Get Min Machines 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. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge.

Get StealthCoder

Related leaked OAs

⏵ The honest play

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

JP Morgan reuses patterns across OAs. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Get Min Machines FAQ

Is this actually asking for the minimum number of machines or a specific assignment?+

Just the count. You don't need to output which task runs on which machine. That simplification is the trick. Focus on counting allocations, not tracking identity.

What if two tasks have the same start time?+

Sort by start time first, then by end time. If a tie still exists, order doesn't matter for correctness, but consistent sorting prevents bugs. The heap handles the rest.

Do overlapping boundaries count as a conflict?+

Standard interview convention: if Task A ends at time 5 and Task B starts at time 5, they don't overlap. A machine finishing at 5 is free for a task starting at 5. Check your comparison operator carefully.

How do I prepare in 48 hours if I've never seen heap problems?+

Learn heap insertion and extraction, then solve one interval scheduling problem on LeetCode. Practice the heap pop-and-push rhythm until it's muscle memory. That's enough for JP Morgan's version.

Is this problem still asked or has JP Morgan moved on?+

Still alive as of September 2024. Resource scheduling is core to their systems work. Expect it again. Master the heap pattern and you'll pass this one cold.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with JP Morgan.

OA at JP Morgan?
Invisible during screen share
Get it