Back to DSA sheet
Number of Islands
MediumGraphsCount the number of islands in a grid of '1' (land) and '0' (water), where islands connect horizontally or vertically.
Constraints
- 1 <= m, n <= 300
- grid[i][j] is '0' or '1'
Sheets
Blind 75Grind 75NeetCode 150NeetCode 250
number-of-islands.cpp
Loading editor
Custom input (stdin)
Output
Run your code to see its output.