Maximum Nesting Depth of Two Valid Parentheses Strings
Solution Code
class Solution:
def maxDepthAfterSplit(self, seq: str) -> List[int]:
ans = []
d = 0
for c in seq:
if c == "(":
d += 1
ans.append(d % 2)
if c == ")":
ans.append(d % 2)
d -= 1
return ansTime Complexity
O(n)
Space Complexity
O(1)

