You are given a 2D grid of characters '1' (land) and '0' (water).
Return how many separate islands (connected land areas) exist.
Land cells that touch up, down, left, or right belong to the same island.
Input: map = [ ["1","1","0","0"], ["1","1","0","0"], ["0","0","1","0"], ["0","0","0","1"] ]
Output: 3
Explanation:
Explanation • Island 1: top-left block • Island 2: single cell in row 3 • Island 3: bottom-right corner
Input: map = [ ["1","0","1"], ["0","1","0"], ["1","0","1"] ]
Output: 5
Explanation:
Every '1' stands alone, so there are 5 islands.
Accepted:
Submission: