已解决
#力扣:2315. 统计星号@FDDLC
来自网友在路上 182882提问 提问时间:2023-10-28 04:31:18阅读次数: 82
最佳答案 问答题库828位专家为你答疑解惑
2315. 统计星号 - 力扣(LeetCode)
一、Java
class Solution {public int countAsterisks(String s) {int cnt = 0;boolean flag = true;for(char c: s.toCharArray()) {if(c == '|') flag = !flag;else if(c == '*' && flag) cnt++;}return cnt;}
}
查看全文
99%的人还看了
猜你感兴趣
版权申明
本文"#力扣:2315. 统计星号@FDDLC":http://eshow365.cn/6-26561-0.html 内容来自互联网,请自行判断内容的正确性。如有侵权请联系我们,立即删除!