Easy
Quiz
#605 Can Place Flowers
APPROACH
A flowerbed is represented by an integer array flowerbed of 0s (empty) and 1s (occupied). Flowers may not be planted in neighboring plots. Given flowerbed and an integer n, return true if n additional flowers can be planted without breaking the adjacency rule, or false otherwise.
Example 1:
Input: flowerbed = [1,0,0,0,1], n = 1
Output: true
Example 2:
Input: flowerbed = [1,0,0,0,1], n = 2
Output: false
1 of 4
1:00
What is the optimal approach for this problem?