File tree 3 files changed +30
-1
lines changed
3 files changed +30
-1
lines changed Original file line number Diff line number Diff line change
1
+ /**
2
+ * @param {number[] } candies
3
+ * @param {number } extraCandies
4
+ * @return {boolean[] }
5
+ */
6
+ var kidsWithCandies = function ( candies , extraCandies ) {
7
+ let max = Math . max ( ...candies ) , result = Array . from ( { length : candies . length } ) . fill ( false ) ;
8
+
9
+ for ( let i = 0 ; i < candies . length ; i ++ ) {
10
+ if ( ( candies [ i ] + extraCandies ) >= max ) result [ i ] = true ;
11
+ }
12
+
13
+ return result ;
14
+ } ;
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @param {number[] } candies
3
+ * @param {number } extraCandies
4
+ * @return {boolean[] }
5
+ */
6
+ var kidsWithCandies = function ( candies , extraCandies ) {
7
+ let max = Math . max ( ...candies ) , result = Array . from ( { length : candies . length } ) . fill ( false ) ;
8
+
9
+ for ( let i = 0 ; i < candies . length ; i ++ ) {
10
+ if ( ( candies [ i ] + extraCandies ) >= max ) result [ i ] = true ;
11
+ }
12
+
13
+ return result ;
14
+ } ;
Original file line number Diff line number Diff line change 94
94
- [ 1187. Make Array Strictly Increasing] ( ./1187/ )
95
95
- [ 1342. Number of Steps to Reduce a Number to Zero] ( ./1342/ )
96
96
- [ 1365. How Many Numbers Are Smaller Than the Current Number] ( ./1365/ )
97
+ - [ 1431. Kids With the Greatest Number of Candies] ( ./1431/ )
97
98
- [ 1480. Running Sum of 1d Array] ( ./1480/ )
98
99
- [ 1512. Number of Good Pairs] ( ./1512/ )
99
100
- [ 1569. Number of Ways to Reorder Array to Get Same BST] ( ./1569/ )
@@ -153,7 +154,7 @@ Batch create:
153
154
NOTE: JS IS HERE
154
155
-->
155
156
``` ssh
156
- chapter=1071 && mkdir ./$chapter && touch ./$chapter/my_solution.js && touch ./$chapter/solution.js && alias x="node ./$chapter/my_solution.js"
157
+ chapter=1431 && mkdir ./$chapter && touch ./$chapter/my_solution.js && touch ./$chapter/solution.js && alias x="node ./$chapter/my_solution.js"
157
158
```
158
159
> then you can use ` x ` for quick debug.
159
160
You can’t perform that action at this time.
0 commit comments