1
2
3
4
5
6
7
8
9
|
class Solution:
def balancedStringSplit(self, s: str) -> int:
cnt=0
ans=0
for i in s:
if i=='R' : cnt+=1
else: cnt-=1
if cnt==0: ans+=1
return ans
|
cs |
반응형
'python-algorithm' 카테고리의 다른 글
Leetcode 1486. XOR Operation in an Array (0) | 2021.07.16 |
---|---|
Leetcode 1791. Find Center of Star Graph (0) | 2021.07.16 |
Leetcode 1773. Count Items Matching a Rule (0) | 2021.07.16 |
Leetcode 1678. Goal Parser Interpretation (0) | 2021.07.16 |
Leetcode 1389. Create Target Array in the Given Order (0) | 2021.07.16 |
댓글