Number of Islands II — union-find
Add land one cell at a time. Each new cell starts its own island, then merges with any land it touches.
Try:
← Prev
Next →
▶ Play
Reset
0
islands
answer after each addition