30Count the Islands
Hardgraphsrecursion
A map is a list of strings where # is land and . is water. Land squares that touch up, down, left or right belong to the same island (diagonals don't count).
Write count_islands(grid) that returns how many islands there are.
Examples
Example 1
>>> count_islands(['##..', '##..', '..#.', '...#']) 3
Example 2
>>> count_islands(['###', '#.#', '###']) 1
Run examples checks the 2 examples above. Submit runs all 7 tests, including hidden edge cases, and marks the challenge solved.