Medium · Graphs
Number of Islands
You are given a grid where each cell is "1" for land or "0" for water. An island is a group of land cells joined up, down, left or right. Return how many islands there are.
- Cells that touch only at a corner are not joined.
- The cells are the text "1" and "0", not numbers.
- Everything beyond the edge of the grid is water.
grid = [["1","1","0"],
["1","0","0"],
["0","0","1"]]
→ 2Record your take