Capacity-Checked GPU Reservation Calendar Over Long Horizons

Last updated: November 29, 2026

Quick Overview

Build a reservation calendar for a pool of C GPUs where book(start, end, k) succeeds only if at least k GPUs are free at every instant in [start, end), with times up to 1e9 and many bookings arriving online.

Coreweave
Coding & Algorithms
Software Engineer
Coreweave
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Hard

0

0

0 solved


Build a reservation calendar for a pool of C GPUs where book(start, end, k) succeeds only if at least k GPUs are free at every instant in [start, end), with times up to 1e9 and many bookings arriving online.

Echoes the reserved-capacity model of an AI GPU cloud, where customers book blocks of GPUs for future training windows and sales needs a fast yes or no. The interviewer probes whether you move past an O(n) interval scan to a range-add, range-max structure and can implement it correctly under pressure.

What the Interviewer Expects
  • Recognizes the check is a range maximum of current usage
  • Chooses a dynamic (sparse) segment tree or coordinate compression and justifies it
  • Implements lazy range add without pushing down incorrectly
  • Uses half-open intervals consistently
  • Validates against a brute force
Key Topics to Cover
Segment tree
Lazy propagation
Interval scheduling
Range max query
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 support cancellation and modification of a booking?
  • If bookings must be on a specific GPU type in a specific region, how do you shard the structure?
  • How would you answer 'earliest start time for k GPUs for d hours'?
  • How do you persist and recover this state?
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

Pool capacity C. book(start, end, k) with half-open [start, end) returns True and records the booking if max usage over [start, end) + k <= C, else False with no change. Times are integers in `[...

High-Level Design

A sorted list of intervals makes each check O(n). Instead store usage as an array over time and support two ops: range max and range add. A segment tree with lazy adds does both in O(log T). Because T...


Submit Your Answer
Markdown supported

Related Questions