Problem 1111 · Medium

Maximum Nesting Depth of Two Valid Parentheses Strings

Split a valid parentheses string into two valid groups so that the deeper of the two has the smallest possible nesting depth. Each character is assigned to a group by its depth parity.

Open the interactive visualisation