Practice
Learn
← Quit
0 / 0 correct
Algorithms
Hard
1 of 20
Why does 'number of islands' use BFS/DFS or union-find?
A
It needs dynamic programming
B
It needs sorting
C
Each island is a connected component of land cells; flood fill or union-find counts components in O(rows × cols)
D
It's a shortest path problem