Can Place Flowers
LeetCode 605 • Easy • Arrays & Hashing
flowerbed = [1,0,0,0,1], n = 1 → true. Place flowers so no two are adjacent.
TimeO(n)
SpaceO(1)
i: —planted: 0need left: 1
Current i
Existing
Newly planted
i—
bed[ ]
Ready
Press Play or Step to walk the algorithm.