Peak Concurrent GPU Demand From Cluster Reservation Requests

Last updated: November 29, 2026

Quick Overview

Given a list of GPU reservations, each with a start time, end time and GPU count on half-open intervals, return the peak number of GPUs reserved at once and the earliest time that peak occurs.

Crusoe
Coding & Algorithms
Software Engineer
Crusoe
November 29, 2026
Software Engineer
Phone Screen
Coding & Algorithms
Easy

0

0

0 solved


Given a list of GPU reservations, each with a start time, end time and GPU count on half-open intervals, return the peak number of GPUs reserved at once and the earliest time that peak occurs.

A warm-up in the style of a Crusoe Cloud platform screen, where capacity planners need to know whether committed reservations ever exceed the GPUs installed in a data hall. The interviewer checks that you reach for a sweep line, handle back-to-back reservations correctly, and talk about tie-breaking at equal timestamps.

What the Interviewer Expects
  • Clarifies whether intervals are half-open and what to return for an empty list
  • Uses a sweep over start and end events instead of checking every time unit
  • Orders releases before acquisitions at the same timestamp
  • States O(n log n) time and O(n) space
  • Tests back-to-back reservations that should not overlap
Key Topics to Cover
Sweep line
Interval overlap
Sorting with tie-breaks
Capacity planning
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you return the full occupancy step function so a UI can chart it?
  • Reservations now target specific GPU types (H100, B200). What changes?
  • How would you answer peak demand for many arbitrary query windows quickly?
  • What if reservations stream in and you must keep the current peak updated?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Input: list of (start, end, gpus) with [start, end) semantics. Output: (peak_gpus, time_of_peak); for no valid reservations return (0, None). Ignore zero-length or zero-GPU entries. A reservat...

High-Level Design

Turn each reservation into two events: +gpus at start and -gpus at end. Sort by time, and at equal times apply negative deltas first so a release frees capacity before the next booking claims it. ...


Submit Your Answer
Markdown supported

Related Questions