string1 Leetcode 1614. Maximum Nesting Depth of the Parentheses 참고: 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 2021. 8. 31. 이전 1 다음