Dsa
Union Find
Easy
Server Load Balancing
You are given a system consisting of N servers and M connections where each connection indicates that two servers can share load. Determine if it is possible to balance the load between two specified servers. Input starts with integers N and M, followed by M lines of connections. The last line contains two integers indicating the two servers of interest. Print 'YES' if they can balance the load, otherwise print 'NO'.
Example Input:
4 3
1 2
2 3
3 4
1 4
Output:
YES
Key concepts
union_findnetworkload_balancing
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