avatar
Siz Long

My name is Siz. I am a computer science graduate student specializing in backend development with Golang and Python, seeking opportunities in innovative tech projects. My personal website is me.longsizhuo.com .Connect with me on LinkedIn: https://www.linkedin.com/in/longsizhuo/.

  • Resume
  • Archives
  • Categories
  • Photos
  • Music



{{ date }}

{{ time }}

avatar
Siz Long

My name is Siz. I am a computer science graduate student specializing in backend development with Golang and Python, seeking opportunities in innovative tech projects. My personal website is me.longsizhuo.com .Connect with me on LinkedIn: https://www.linkedin.com/in/longsizhuo/.

  • 主页
  • Resume
  • Archives
  • Categories
  • Photos
  • Music

2315. Statistical star number One question daily

  2024-01-01        
字数统计: 119字   |   阅读时长: 1min

2023-01-29.png
2315. Statistical star number

Thought:

mine:The simple version of the simple out of the stack into the stack
@ylq:right|Number count,The number is2Perform the multiple*Count

Code:

Out of the stack into the stack
1
2
3
4
5
6
7
8
9
10
11
12
13
class Solution:
def countAsterisks(self, s: str) -> int:
stack = True
flag = 0
for i in s:
if stack:
if i == '*':
flag += 1
if i == '|' and stack:
stack = False
elif i == '|' and not stack:
stack = True
return flag
ylq
1
2
3
4
5
6
7
8
9
class Solution:
def countAsterisks(self, s: str) -> int:
count1, count2 = 0, 0
for i in range(len(s)):
if s[i] == '|':
count1 += 1
if count1 % 2 == 0 and s[i] == '*':
count2 += 1
return count2
  • Python
  • answer
  • One question daily

扫一扫,分享到微信

微信分享二维码
2309. The best English letters with both appropriates and lowercases One question daily
2325Decrypt One question daily
目录
  1. 1. Thought:
  2. 2. Code:

150 篇 | 131.7k
次 | 人
这里自动载入天数这里自动载入时分秒
2022-2025 loong loong | 新南威尔士龙龙号