Problem 605 · Easy

Can Place Flowers

Plant flowers one at a time in the first empty slot that has no neighbour occupied, and stop once the requested number is reached. The visual highlights each placed flower and shows that the greedy choice leaves room for later ones.

Open the interactive visualisation