Islands

From programming_contest
Jump to navigation Jump to search

Given a map, with marked land, water, and ???, determine the minimum number of disjoint pieces of land.

Quite a simple flood fill. When you find a piece of land, flood fill everything around it, including clouds, assuming they are land, and count 1 island.

All other clouds (which don't touch land) are considered water.