In order to place `x`

flowers between position `i`

and position `j`

, we must have `j - i >= 2*x + 2`

. And remember to handle to boundary cases.

```
class Solution(object):
def canPlaceFlowers(self, flowerbed, n):
"""
:type flowerbed: List[int]
:type n: int
:rtype: bool
"""
have = [-2] + [i for i, x in enumerate(flowerbed) if x] + [len(flowerbed) + 1]
return sum(abs(have[i] - have[i-1] - 2) // 2 for i in range(1, len(have))) >= n
```