How to approach this?

How do i start this problem
also arent these 2 statements contradicting

At any index, number of opening brackets should be greater than closing brackets
No. of opening and closing brackets should be equal.

Hey @bhavik911
This question is a clear dynamic programming question and can be solved by dp only because it is a clear combinatorial optimization problem.
if you dont Know dynamic programming . leave it for now

1 Like

Okay , I will try it later then thanks