Dsa
Graphs Bfs
Warm-up
Server Network Audit
You are auditing a data center. There are N servers (0 to N-1). Some servers are connected by physical cables. A server is 'reachable' if there is a path from the 'Master Server' (always Server 0). Your task is to count how many servers are NOT reachable from the Master Server.
Example:
Input:
5 3
0 1
1 2
3 4
Output:
2
(Servers 3 and 4 are unreachable from 0.)
Key concepts
graphsbfsconnected components
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now