Dsa
Graphs Dfs
Hard
Corrupt File Recovery
In a file recovery application, you track clusters of corrupt blocks within a large file. Each cluster may be connected directly to another cluster. Given a set of connections between clusters, identify the maximum number of clusters that can be recovered from a single corrupt block.
Input Format:
- An integer n representing the number of clusters.
- The following n lines contain two integers u and v per line, representing a connection between corrupt blocks (zero-indexed). Input ends with 'END'.
Output Format:
- Print a single integer representing the maximum number of clusters that can be recovered from one corrupt block.
Example Input:
5
0 1
1 2
2 3
3 4
END
Example Output:
5
Key concepts
graphsdfsdata recovery
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