class Solution {

public:

bool canPlaceFlowers(vector<int>& flowerbed, int n) {

int start=-2, sum=0, i=0;

for(i=0; i<flowerbed.size(); i++)

{

if(flowerbed[i] == 1)

{

sum += ((i-1)-start-1)/2;

start = i;

}

}

sum += (i-start-1) / 2;

```
return sum>=n;
}
```

};