Question bank › Graphs Bfs
Dsa Graphs Bfs Hard

Network Access Optimization

In a computer network, each computer can communicate with others via direct connections (edges). Given the configuration of the network, determine the minimum number of routers that need to be added so that every computer can communicate with the others directly or indirectly through a router. Each router can connect up to K computers. Input: - The first line contains C (number of computers), R (number of connections), and K (max connections per router). - The next R lines each contain two integers, a and b (1 ≤ a, b ≤ C), indicating a direct connection between computers a and b. Output: - Print the minimum number of additional routers needed so that all computers can communicate either directly or through other routers. Example: Input: 4 2 1 2 3 4 2 Output: 1

Key concepts

graphsbfsnetwork-flow

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
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.