Problem 2658 · Medium

Maximum Number of Fish in a Grid

Flood-fill each connected patch of water, adding up its fish, and keep the richest patch.

Open the interactive visualisation