File tree 3 files changed +42
-1
lines changed
3 files changed +42
-1
lines changed Original file line number Diff line number Diff line change
1
+ /**
2
+ * @param {string } s
3
+ * @return {string }
4
+ */
5
+ var removeStars = function ( s ) {
6
+ let result = [ ]
7
+ for ( let i = 0 ; i < s . length ; i ++ ) {
8
+ if ( s [ i ] === "*" ) {
9
+ result . pop ( ) ;
10
+ } else {
11
+ result . push ( s [ i ] )
12
+ }
13
+ }
14
+
15
+ return result . join ( "" )
16
+ } ;
17
+
18
+
19
+ let x =
20
+ // removeStars("erase*****")
21
+ removeStars ( "leet**cod*e" )
22
+
23
+ console . log ( "Es" )
24
+ console . log ( x )
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @param {string } s
3
+ * @return {string }
4
+ */
5
+ var removeStars = function ( s ) {
6
+ let result = [ ]
7
+ for ( let i = 0 ; i < s . length ; i ++ ) {
8
+ if ( s [ i ] === "*" ) {
9
+ result . pop ( ) ;
10
+ } else {
11
+ result . push ( s [ i ] )
12
+ }
13
+ }
14
+
15
+ return result . join ( "" )
16
+ } ;
Original file line number Diff line number Diff line change 124
124
- [ 2215. Find the Difference of Two Arrays] ( ./2215/ )
125
125
- [ 2352. Equal Row and Column Pairs] ( ./2352/ )
126
126
- [ 2373. Largest Local Values in a Matrix] ( ./2373/ )
127
+ - [ 2390. Removing Stars From a String] ( ./2390/ )
127
128
- [ 2448. Minimum Cost to Make Array Equal] ( ./2448/ )
128
129
129
130
---
@@ -172,7 +173,7 @@ Batch create:
172
173
NOTE: JS IS HERE
173
174
-->
174
175
``` ssh
175
- chapter=2352 && mkdir ./$chapter && touch ./$chapter/my_solution.js && touch ./$chapter/solution.js && alias x="node ./$chapter/my_solution.js"
176
+ chapter=2390 && mkdir ./$chapter && touch ./$chapter/my_solution.js && touch ./$chapter/solution.js && alias x="node ./$chapter/my_solution.js"
176
177
```
177
178
> then you can use ` x ` for quick debug.
178
179
You can’t perform that action at this time.
0 commit comments