Your question is Count Islands in a Grid. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
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.
1 <= rows, cols <= 300grid[i][j] is '0' or '1'