# [605\. 种花问题](https://leetcode-cn.com/problems/can-place-flowers/)
![](https://box.kancloud.cn/4740950d2ac7a1afc86c8c9aad8db051_624x420.png)
```
func canPlaceFlowers(flowerbed []int, n int) bool {
var i int
if len(flowerbed)<2 {
if flowerbed[0] == 0 {
i ++
}
goto panduan
}
for k:=0;k<len(flowerbed);k++ {
switch {
case k == 0:
if flowerbed[0] == 0 && flowerbed[1] == 0 {
i++
k++
}
case k != len(flowerbed)-1:
if flowerbed[k] == 0 && flowerbed[k-1]==0 && flowerbed[k+1]==0{
i++
k++
}
case k == len(flowerbed)-1:
if flowerbed[k] == 0 && flowerbed[k-1] == 0 {
i++
}
}
}
panduan:
if i >= n {
return true
}
return false
}
```