File tree 3 files changed +17
-1
lines changed
3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change
1
+ /**
2
+ * @param {number[] } flowerbed
3
+ * @param {number } n
4
+ * @return {boolean }
5
+ */
6
+ var canPlaceFlowers = function ( flowerbed , n ) {
7
+ if ( n === 0 ) return true ;
8
+
9
+ let placeNeeded = 1 ;
10
+ for ( let i = 0 ; i < n ; i ++ ) {
11
+ placeNeeded += 2 ;
12
+ }
13
+
14
+ return ( flowerbed . length - 2 ) >= placeNeeded ;
15
+ } ;
Original file line number Diff line number Diff line change 82
82
- [ 435. Non-overlapping Intervals] ( ./435/ )
83
83
- [ 530. Minimum Absolute Difference in BST] ( ./530/ )
84
84
- [ 572. Subtree of Another Tree] ( ./572/ )
85
+ - [ 605. Can Place Flowers] ( ./605/ )
85
86
- [ 647. Palindromic Substrings] ( ./647/ )
86
87
- [ 771. Jewels and Stones] ( ./771/ )
87
88
- [ 714. Best Time to Buy and Sell Stock with Transaction Fee] ( ./714/ )
@@ -154,7 +155,7 @@ Batch create:
154
155
NOTE: JS IS HERE
155
156
-->
156
157
``` ssh
157
- chapter=1431 && mkdir ./$chapter && touch ./$chapter/my_solution.js && touch ./$chapter/solution.js && alias x="node ./$chapter/my_solution.js"
158
+ chapter=605 && mkdir ./$chapter && touch ./$chapter/my_solution.js && touch ./$chapter/solution.js && alias x="node ./$chapter/my_solution.js"
158
159
```
159
160
> then you can use ` x ` for quick debug.
160
161
You can’t perform that action at this time.
0 commit comments