Number of Connected Components
This is the abstract form of Number of Islands — it builds intuition for connected-components counting and introduces Union-Find as an elegant alternative to BFS/DFS for this class of problem.
Enable JavaScript for the full StreamPrep guide.