Skip to main content

maximumNestingDepthOfParentheses

class Solution:
def maxDepth(self, s: str) -> int:
resp = 0
curr = 0
for _char in s:
if _char == '(':
curr += 1
elif _char == ')':
curr -= 1

resp = max(resp, curr)

return(resp)