Skip to content

Commit ab0078a

Browse files
author
Adam Lin
committed
Use the case could be [0,0,0] n=2
1 parent 3b82454 commit ab0078a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

605_canPlaceFlowers.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ class Solution {
22
public:
33
bool canPlaceFlowers(vector<int>& flowerbed, int n) {
44
int planted = 0;
5+
// Use the case could be [0,0,0] n=2
56
// Add zeros to the beginning and end of the flowerbed to simplify boundary conditions
67
// This helps handle edge cases uniformly without extra checks for the first and last elements
78
flowerbed.insert(flowerbed.begin(), 0);

0 commit comments

Comments
 (0)