Dsa
Union Find
Medium
Network Redundancy
A network of computers is monitored by a centralized system. The network is represented as a series of connections between computers. Your task is to determine the minimum number of direct connections that can be removed such that the network remains fully connected (known as the redundancy).
Input format:
- The first line contains an integer n (1 ≤ n ≤ 1000), the number of computers.
- The second line contains an integer m (0 ≤ m ≤ 10000), the number of connections.
- The following m lines contain two integers a and b (1 ≤ a, b ≤ n) representing connections between computers a and b.
Output format:
- Print an integer which gives the maximum number of connections that can be removed while keeping the network connected.
Example:
Input:
4
5
1 2
1 3
2 3
2 4
3 4
Output:
1
Key concepts
union_findredundancynetwork
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