2315. Count Asterisks
Question
You are given a string
s, where every two consecutive vertical bars'|'are grouped into a pair. In other words, the 1st and 2nd'|'make a pair, the 3rd and 4th'|'make a pair, and so forth.Return *the number of
'*'ins, excluding the'*'between each pair of *'|'.Note that each
'|'will belong to exactly one pair.
Solution
统计“|”字符出现的数量,如果数量为偶数时,则计算出现的“*”符号。
Code
1 | class Solution { |
2315. Count Asterisks
