Brackets all over

please provide code of this problem as even after unlocking editorial there’s no code present , and I am unable to formulate the solution , spent more than 4 days on this question

i am sending a dp solution, try to go about it in case of any doubts feel free to ask me

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.