
Given a 2D grid of '1' and '0', count how many islands it contains. An island is formed by horizontally or vertically adjacent land cells, and water separates different islands.
grid = [["1","1","1","1","0"],["1","1","0","1","0"],["1","1","0","0","0"],["0","0","0","0","0"]]Output1WhyAll land belongs to one connected component.grid = [["1","1","0","0","0"],["1","1","0","0","0"],["0","0","1","0","0"],["0","0","0","1","1"]]Output3WhyThere are three disconnected groups of land.`1 <= rows, cols <= 300``grid[i][j]` is `'0'` or `'1'`Only 4-directional adjacency counts