Skip to content

Commit 1b4af60

Browse files
committed
2021-03-16
1 parent ad59c58 commit 1b4af60

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
class Solution(object):
2+
def maxDepth(self, s):
3+
"""
4+
:type s: str
5+
:rtype: int
6+
"""
7+
depth = 0
8+
res = 0
9+
for ch in s:
10+
if ch == "(":
11+
depth += 1
12+
res = max(res, depth)
13+
elif ch == ")":
14+
depth -= 1
15+
16+
return res

0 commit comments

Comments
 (0)