The problem basically asks you to find the maximum DEPTH of the brackets i.e. the maximum number of open brackets at any time in the sequence. Now you have to replace by the smallest sequence of brackets containing same depth, which will be a sequence of open brackets followed by the sequence of same number of closed brackets.

2 Likes