Islands

From programming_contest
Revision as of 14:57, 2 November 2017 by imported>Kmk21
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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.