Number of Islands

Given an m x n 2D binary grid which represents a map of '1' (land) and '0' (water), return the number of islands.

An island is surrounded by water and is formed by connecting adjacent land cells horizontally or vertically. You may assume all four edges of the grid are surrounded by water.

The grid is given as an array of equal length strings, so every row is indexed like grid[r][c].

Examples
Input: ["11110","11010","11000","00000"]
Output: 1
Hints

Number of Islands

Given an `m x n` 2D binary grid which represents a map of `'1'` (land) and `'0'` (water), return the number of islands.