Count NVLink Islands as Links Fail Over Time
Last updated: November 29, 2026
Quick Overview
A server has n GPUs connected by a list of NVLink links. Links fail one at a time in a given order (each link fails at most once and never recovers). After each failure, report how many connected groups of GPUs exist.
NVIDIA
November 29, 20260
0
0 solved
A server has n GPUs connected by a list of NVLink links. Links fail one at a time in a given order (each link fails at most once and never recovers). After each failure, report how many connected groups of GPUs exist.
Asked in onsites for NVIDIA teams working on DGX and NVSwitch fabric management, where the topology manager must know which GPUs can still communicate directly. The key insight interviewers look for is that deletions are hard for union-find, so you process the failures offline in reverse as additions.
What the Interviewer Expects
- Recognizes that union-find supports merges but not splits
- Reverses time: start from the final graph and add links back
- Records the component count before each re-addition to get the forward answers
- Implements union by size and path compression
- States near-linear complexity and contrasts with recomputing BFS per failure
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
- What if failures arrive online and you must answer immediately?
- How would you also report the size of the largest island after each failure?
- What if a link can fail and later recover, possibly several times?
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: n, links as (u, v) pairs, and failures, a list of distinct link indices in the order they fail. Output: a list where entry k is the number of connected components right after failure k....
High-Level Design
Recomputing connectivity with BFS after each failure is O(F (n + E)), too slow for large fabrics. Union-find makes merging cheap but cannot split. Since we know the whole failure sequence, reverse it:...