Compute Remaining GPUs With Switching Limits
Company: Mistral AI
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: hard
Interview Round: Technical Screen
Quick Answer: This question evaluates a candidate's ability to perform time-series aggregation, array manipulation, and constrained optimization for selecting resources across multiple clusters and days.
Part 1: Daily Remaining GPUs by Cluster
Constraints
- 0 <= num_days <= 10000
- 0 <= len(capacities) <= 200
- 0 <= len(usages) <= 200000
- 0 <= gpu_used
- For every day and cluster, total gpu_used does not exceed that cluster's capacity
Examples
Input: ([10, 20], 3, [(2, 0, 2), (0, 1, 13), (1, 1, 8), (2, 1, 2), (0, 0, 5)])
Expected Output: [[5, 7], [10, 12], [8, 18]]
Explanation: Usages are unsorted. Day 0 leaves [5, 7], day 1 leaves [10, 12], and day 2 leaves [8, 18].