1614. 括号的最大嵌套深度
class Solution:
def maxDepth(self, s: str) -> int:
maxD = 0
if not s:
return maxD
stack = []
for char in s:
if char=='(':
stack.append(char)
maxD = max(maxD,len(stack))
elif char==')' :
stack.pop()
return maxD