Can Place Flower
605. Can Place Flower
Suppose you have a long flowerbed in which some of the plots are planted and some are not. However, flowers cannot be planted in adjacent plots - they would compete for water and both would die.
Given a flowerbed (represented as an array containing 0 and 1, where 0 means empty and 1 means not empty), and a numbern, return ifnnew flowers can be planted in it without violating the no-adjacent-flowers rule.
给一个数组, 代表花圃, 和一个数字n表示要种的画的数量. 问花圃能不能种下这么多的花
花圃有0和1组成, 0表示空位, 1表示已经有花种在那里了.
如果要往一个空位里面种花, 需要满足一个条件: 该位置左右都是空的.