Problem
A flowerbed has a row of plots. The array flowerbed describes the plots. The value 0 is an empty plot, and 1 is a plot with a flower.
Two flowers cannot grow in adjacent plots. Adjacent plots are plots that are next to each other.
You want to plant n new flowers in empty plots. Return true if you can plant all n flowers and obey the rule. Return false otherwise.
Example 1
- Input:
- flowerbed = [0,0,1,0,0,0,0], n = 2
- Output:
- true
- Explanation:
- One correct choice is index 0 and index 4.
Example 2
- Input:
- flowerbed = [0,1,0,0,1,0], n = 1
- Output:
- false
- Explanation:
- Each empty plot is next to a plot with a flower.
Example 3
- Input:
- flowerbed = [1,0,0,0,0,1], n = 1
- Output:
- true
Constraints
- 1 <= flowerbed.length <= 2 * 10^4
- flowerbed[i] is 0 or 1.
- flowerbed has no two adjacent flowers.
- 0 <= n <= flowerbed.length
SysRound wrote this statement. A reference solution checks every example.
Related questions
Continue with questions that share topics or the same question type.
- Furthest Building You Can Reach
Coding · Array · Greedy · Heap (Priority Queue)
- Advantage Shuffle
Coding · Array · Greedy · Sorting
- Avoid Flood in The City
Coding · Array · Binary Search · Greedy
- Best Time to Buy and Sell Stock II
Coding · Array · Dynamic Programming · Greedy
Sources · 2 references
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 2 records
LinkedIn
Leetcode 605. Can Place Flowers
Reported Sep 30, 2026 · 8 source reports
JUNIOR, SENIOR
Source snapshot: Nov 12, 2026
View sourceMeta
Leetcode 605. Can Place Flowers
Reported Aug 31, 2026 · 3 source reports
MID_LEVEL, SENIOR
Source snapshot: Nov 12, 2026
View source
LeetCode company tags · 3 records
LinkedIn
Can Place Flowers
Reported date not specified · Source window: 30d
Source snapshot: Oct 20, 2026
Source frequency score: 82.4. This is not an interview probability.
View sourceLinkedIn
Can Place Flowers