Search across blog, articles, projects, courses, and community posts
A grid is made of land (1) and water (0). An island is a group of land cells connected up, down, left or right (not diagonally). Count the islands.
Input:
rows cols.rows lines, each a string of cols characters (0 or 1).Output: the number of islands.
1 <= rows, cols <= 50. There are no spaces inside a row.
4 5 11000 11000 00100 00011
3
1 3 101
2