Problem Explanation -->

Can someone explain me the problem statement ans how to approach the problem. Please explain using given test cases,

Hi Mohit,
See for input:
4 2
((

there are two opening brackets and according to question we have to balance the brackets by adding two string a and b such that size of overall new string formed is equal to given number n and at the same time we have to make sure that at every index of string opening brackets should be more than or equal to closing brackets. In above test case since size of final string given is 4 and size of original string given is 2 therefore we have to add two brackets more to satisfy above conditions and hence there is only one way possible that first string is empty and second one contains two closing brackets so that final string is “(())” .

And hence output is 1.

1 Like

“Run code” button is not working in online.codingblocks.com website. Please check.

Hi Mohit,
Run button isn’t working that means either your code is having an infinte loop or any special character

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.