Number of islandsMedium
You're given a
m x n2D grid of 1s and 0s, where 1 represents land and 0 represents water, find the number of islands that exist in the grid.
Consider an island as a group of adjacent 1s.
Adjancent cells are cells that are in either 4 directions - left, right, down, or up.
For example, given the following grid
grid = [[1, 0, 0],[0, 1, 1],[0, 1, 0]]
Your function should return
Before you look at the solution, try to code it yourself.