참고: leetcode r0bertz
1
2
3
4
5
6
7
8
9
|
class Solution:
def maxDepth(self, s: str) -> int:
ans=cnt=0
for i in s:
if i =="(" :
cnt+=1
ans=max(ans,cnt)
elif i==")" : cnt-=1
return ans
|
cs |
반응형
'python-algorithm' 카테고리의 다른 글
Hacker rank Solve Me First (0) | 2021.10.26 |
---|---|
Leetcode 136. Single Number (0) | 2021.09.24 |
Leetcode 1979. Find Greatest Common Divisor of Array (0) | 2021.08.31 |
Leetcode 1588. Sum of All Odd Length Subarrays (0) | 2021.08.31 |
Leetcode 1720. Decode XORed Array (0) | 2021.08.31 |
댓글