Peak GPU Demand Across Overlapping Simulation Jobs
Last updated: November 29, 2026
Quick Overview
Each simulation job has a start time, an end time (exclusive) and a number of GPUs it holds. Return the peak number of GPUs in use at once and the earliest time that peak begins.
Applied Intuition
November 29, 20260
0
0 solved
Each simulation job has a start time, an end time (exclusive) and a number of GPUs it holds. Return the peak number of GPUs in use at once and the earliest time that peak begins.
Applied Intuition runs large batches of simulation on shared GPU clusters, so capacity questions come up naturally. Interviewers look for the sweep-line pattern and careful ordering of events at the same timestamp.
What the Interviewer Expects
- Turn each job into a +g event at start and a -g event at end
- Sort events and process releases before acquisitions at equal times
- Track the running total and the first time the maximum is reached
- Ignore zero or negative length jobs
- Explain why half-open intervals matter
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you return the full usage timeline for plotting?
- How would you answer many queries of usage at time t?
- What if jobs arrive online and you need the current peak continuously?
- How do you find the minimum cluster size so no job ever waits?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Jobs are (start, end, gpus) with half-open intervals, so a job ending at 10 frees its GPUs before one starting at 10 takes them. Return (peak, time_of_peak); (0, None) when there are no jobs....
High-Level Design
Create 2n events. Sorting by (time, delta) puts negative deltas first at a tie, which encodes the half-open rule. Walk events in order, keep the running sum and update the peak only when it strictly...
Submit Your Answer
Applied Intuition Software Engineer Interview Guide
Interview process, tips, and preparation timeline