Search⌘ K
AI Features

Number of Islands II

Explore the union-find algorithm to solve the Number of Islands II problem where land cells are added dynamically to a water grid. Learn to track island counts after each addition by connecting land cells horizontally and vertically, gaining skills to tackle similar graph and connectivity problems.

Statements

You are given a 2D2D binary grid of size m×nm × n. In this grid, 00 represents water and 11 ...