Number of Islands
Medium📝 Description
Count number of islands in 2D grid (1=land, 0=water)
Input Format
2D grid of 1s and 0s
Output Format
Integer count
Constraints
m == grid.length n == grid[i].length
🔍 Sample Input
[["1","1","0","0","0"],["1","1","0","0","0"],["0","0","1","0","0"],["0","0","0","1","1"]]
✅ Sample Output
3
Code Editor
Please login to run and submit code.
Results
Suggested Solution
Shortcuts: Ctrl+Enter to submit, Ctrl+Shift+R to run