Given an m × n 2D grid of '1's (land) and '0's (water), count the number of islands.
An island is surrounded by water and formed by connecting adjacent lands horizontally or vertically.
With this grid:
1 1 0 0 0
1 1 0 0 0
0 0 1 0 0
0 0 0 1 1
There are 3 islands: top-left 2×2 block, middle single cell, bottom-right 2 cells.
Constraints: .