Split Azure Services Into Two Fault Zones With No Shared Link
Last updated: November 29, 2026
Quick Overview
Given an undirected graph where nodes are services and an edge means two services must not be placed in the same fault zone, decide whether you can assign every service to one of two zones so no edge connects services in the same zone.
Microsoft
November 29, 20260
0
0 solved
Given an undirected graph where nodes are services and an edge means two services must not be placed in the same fault zone, decide whether you can assign every service to one of two zones so no edge connects services in the same zone.
This is bipartite checking in the style of Microsoft technical screens, framed around Azure availability zone placement. The interviewer checks two-coloring with BFS or DFS, handling of disconnected components, and whether you can explain that an odd cycle is the obstruction.
What the Interviewer Expects
- Model as two-coloring an undirected graph
- Run BFS from every uncolored node to cover disconnected parts
- Assign the opposite color to neighbors and detect conflicts
- Explain the odd cycle characterization
- Return the actual zone assignment if asked
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 return an odd cycle as proof when it fails?
- What if there are three zones instead of two?
- How would you handle edges that arrive incrementally?
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 services labeled 0..n-1 and a list of conflict edges (u, v). Output: True if a valid two-zone assignment exists. The graph can be disconnected and may have isolated nodes....
High-Level Design
Build an adjacency list. Keep color[v] as -1 for unvisited. For each uncolored node, start a BFS, color it 0, and for each neighbor either color it 1 - color[u] if unvisited, or return False if it...