LeetCodeMaximum Nesting Depth of Two Valid Parentheses StringsMaximum Nesting Depth of Two Valid Parentheses StringsMediumStringStackSolution export function maxDepthAfterSplit(seq: string): number[] { const answer: number[] = []; let depth = 0; for (const char of seq) { if (char === '(') { depth += 1; answer.push(depth % 2); } else { answer.push(depth % 2); depth -= 1; } } return answer; } Complexity Time: O(n)O(n)O(n) Space: O(1)O(1)O(1) LeetCodeMaximum Nesting Depth of Two Valid Parentheses Stringshttps://leetcode.com/problems/maximum-nesting-depth-of-two-valid-parentheses-strings