Problem with approach

I am totally clueless about how to proceed. Please help

This problem shall be approached through Dynamic Programming.
So to begin with your concern should only be the unbalanced brackets in the string and you have to take into account brackets to be added before string, brackets to be added after the given string and what type of bracket to be added.
Hence you get 3 states to handle which makes it 3D Dynamic Programming.
Give it a try

Hope this was helpful
Thank You

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.