1614. Maximum Nesting Depth of the Parentheses
Содержание
class Solution:
def maxDepth(self, s: str) -> int:
stack = []
res = 0
for c in s:
if c == '(':
stack.append(1)
res = max(res, len(stack))
elif c == ')':
stack.pop()
return res