File tree 3 files changed +55
-0
lines changed
3 files changed +55
-0
lines changed Original file line number Diff line number Diff line change 206
206
| 2293| [ 极大极小游戏] ( https://leetcode.cn/problems/min-max-game/ ) | [ JavaScript] ( ./algorithms/min-max-game.js ) | Easy|
207
207
| 2299| [ 强密码检验器 II] ( https://leetcode.cn/problems/strong-password-checker-ii/ ) | [ JavaScript] ( ./algorithms/strong-password-checker-ii.js ) | Easy|
208
208
| 2309| [ 兼具大小写的最好英文字母] ( https://leetcode.cn/problems/greatest-english-letter-in-upper-and-lower-case/ ) | [ JavaScript] ( ./algorithms/greatest-english-letter-in-upper-and-lower-case.js ) | Easy|
209
+ | 2315| [ 统计星号] ( https://leetcode.cn/problems/count-asterisks/ ) | [ JavaScript] ( ./algorithms/count-asterisks.js ) | Easy|
209
210
| 2351| [ 第一个出现两次的字母] ( https://leetcode.cn/problems/first-letter-to-appear-twice/ ) | [ JavaScript] ( ./algorithms/first-letter-to-appear-twice.js ) | Easy|
210
211
| 面试题 04.12| [ 面试题 04.12. 求和路径] ( https://leetcode.cn/problems/paths-with-sum-lcci/ ) | [ JavaScript] ( ./algorithms/paths-with-sum-lcci.js ) | Medium|
211
212
| 面试题 02.07| [ 面试题 02.07. 链表相交] ( https://leetcode.cn/problems/intersection-of-two-linked-lists-lcci/ ) | [ JavaScript] ( ./algorithms/intersection-of-two-linked-lists-lcci.js ) | Easy|
Original file line number Diff line number Diff line change
1
+ /**
2
+ * 2315. 统计星号
3
+ * @param {string } s
4
+ * @return {number }
5
+ */
6
+ var countAsterisks = function ( s ) {
7
+ let count = 0 ;
8
+ let j = 0 ;
9
+
10
+ for ( let i = 0 ; i < s . length ; i ++ ) {
11
+ if ( s [ i ] === '|' ) {
12
+ j ++ ;
13
+ if ( j === 2 ) {
14
+ // reset
15
+ j = 0
16
+ }
17
+ }
18
+ if ( s [ i ] === '*' && j === 0 ) {
19
+ count ++ ;
20
+ }
21
+ }
22
+ return count ;
23
+ } ;
Original file line number Diff line number Diff line change
1
+ /*
2
+ * @lc app=leetcode.cn id=2315 lang=javascript
3
+ *
4
+ * [2315] 统计星号
5
+ */
6
+
7
+ // @lc code=start
8
+ /**
9
+ * @param {string } s
10
+ * @return {number }
11
+ */
12
+ var countAsterisks = function ( s ) {
13
+ let count = 0 ;
14
+ let j = 0 ;
15
+
16
+ for ( let i = 0 ; i < s . length ; i ++ ) {
17
+ if ( s [ i ] === '|' ) {
18
+ j ++ ;
19
+ if ( j === 2 ) {
20
+ // reset
21
+ j = 0
22
+ }
23
+ }
24
+ if ( s [ i ] === '*' && j === 0 ) {
25
+ count ++ ;
26
+ }
27
+ }
28
+ return count ;
29
+ } ;
30
+ // @lc code=end
31
+
You can’t perform that action at this time.
0 commit comments