← ALL NOTES
Array

605. Can Place Flowers

A flowerbed of 0s (empty) and 1s (planted); no two flowers may be adjacent. Can you plant n more? The greedy is the natural instinct and it's provably right here: sweep left to right and plant in the…

Loading…