CodeOath
← All problems

Number of Islands

Medium
graphbfs-dfsmatrix

Count islands of "1"s (connected horizontally/vertically) in a grid of "1"/"0" strings.

Example:

Input: grid = [["1","1","0"],["0","1","0"],["0","0","1"]]
Output: 2