Number of Islands
Medium๐ท๏ธ Graphs๐ Graphs
๐งฉ The problem
The grid holds "1" (land) and "0" (water). Count the islands (land connected up/down/left/right).
Examples
[["1","1","0"],["0","1","0"],["0","0","1"]] โ 2
๐ฏ Aim for: O(rows ร cols) time
โ๏ธ Write your solution
Pick a language, press Run to try it, then Run tests to check it against every test case โ just like a coding interview.