You are given a 2D grid of characters where:
'1'
represents land
'0'
represents water
A group of land cells forms an island if they are connected 4-directionally (up, down, left, right). Determine the number of islands in the grid.
grid
: an
m x n
matrix of characters (
'0'
or
'1'
).
1 <= m, n <= 300
grid[i][j] ∈ {'0','1'}