Plan Rolling Firmware Upgrade Waves With Rack Limits

Last updated: November 29, 2026

Quick Overview

Given each node's rack, a map of upgrade dependencies (a switch must be upgraded before nodes behind it), and a cap on how many nodes per rack may be down at once, produce the sequence of upgrade waves, or report a cycle.

Fluidstack
Coding & Algorithms
Software Engineer
Fluidstack
November 29, 2026
Software Engineer
Technical Screen
Coding & Algorithms
Medium

0

0

0 solved


Given each node's rack, a map of upgrade dependencies (a switch must be upgraded before nodes behind it), and a cap on how many nodes per rack may be down at once, produce the sequence of upgrade waves, or report a cycle.

Fluidstack rolls out GPU driver, BIOS and NIC firmware across clusters that customers are actively using, so it must respect ordering constraints and keep enough capacity online in every rack. The interviewer wants to see topological sort applied to a real operational constraint, plus the extra per-wave capacity rule.

What the Interviewer Expects
  • Model dependencies as a DAG and use Kahn's algorithm
  • Apply the per-rack cap within each wave and defer the rest
  • Detect cycles and fail loudly
  • Produce deterministic output
  • Explain why waves are minimal or where the greedy may not be optimal
Key Topics to Cover
Topological sort
Kahn's algorithm
Greedy batching
Cycle detection
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 handle a node that fails its upgrade mid-wave?
  • How would you add a global cap on total nodes down, not just per rack?
  • Is the greedy wave count optimal? Give a case where it is not.
  • How do you prioritise nodes on the critical path of the dependency graph?
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: rack_of maps every node to its rack, deps maps a node to prerequisites that must finish in an earlier wave, per_rack_cap bounds nodes per rack per wave. Output: list of waves (lists of no...

High-Level Design

Kahn's algorithm in levels. The ready set holds nodes whose prerequisites are all done. Each wave walks the sorted ready set and admits a node only if its rack is under the cap; others are deferred to...


Submit Your Answer
Markdown supported

Related Questions