Can Place Flowers

Easy · Greedy · about 10 minutes

Asked at LinkedIn, Meta, Microsoft, Amazon, Google, Grammarly, Quora.

flowerbed is a row of plots, 0 meaning empty and 1 meaning a flower is already there. No two flowers may be in neighboring plots. Can you add n more flowers without breaking that rule?