Rolling Average Rack Power Alarm From Telemetry Samples
Last updated: November 29, 2026
Quick Overview
Given a stream of per-minute power readings in kW for one rack and a window size k, return the indices at which the average of the last k readings exceeds the rack's power limit.
Crusoe
November 29, 20260
0
0 solved
Given a stream of per-minute power readings in kW for one rack and a window size k, return the indices at which the average of the last k readings exceeds the rack's power limit.
Crusoe runs dense GPU racks where a sustained draw over the provisioned limit can trip breakers, so short spikes matter less than a sustained average. This style of assessment problem checks a clean O(n) sliding window and careful handling of the warm-up period before k samples exist.
What the Interviewer Expects
- Uses a running sum rather than re-summing each window
- Does not alarm before k samples have arrived (or states the chosen behavior)
- Avoids floating point drift by comparing sum against limit times k
- Runs in O(n) time and O(k) space
- Names the empty and k larger than input cases
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 suppress repeat alarms until the average drops below a lower clear threshold (hysteresis)?
- Samples can arrive late or be missing. How do you window by time instead of by count?
- How would this run per rack across a 1 GW campus with tens of thousands of racks?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Input: list samples of kW floats, window k >= 1, limit limit_kw. Output: indices i where mean(samples[i-k+1..i]) > limit_kw. Only full windows count, so the first possible alarm index is `k-...
High-Level Design
Keep a deque of the last k readings and a running total. On each new sample add it, evict the oldest when the window exceeds k, and compare total > limit_kw * k so we avoid a division per step. In p...