Problem
Given a 2D grid of '1' and '0', count how many islands it contains. An island is formed by horizontally or vertically adjacent land cells, and water separates different islands.
Constraints
1 <= rows, cols <= 300grid[i][j]is'0'or'1'- Only 4-directional adjacency counts
You are practicing as a guest. Sign up free to run your code against the sample data. Your draft stays right here.



