Number of Islands — DFS flood fill
Scan for land; each time you hit an unvisited cell, count one island and sink everything connected to it.
Try:
0
islands
water unvisited land current cell flooded island