No test case is passing even after getting the desired ans plz help

You are getting the desired output but the output format is different from the expected answer.
For input 2,
The answer should be
()()
(())

But your code is giving the output as
(())
()()

Thus you are unable to get the correct result.
On looking at the results we can find that we need to add a closing bracket first, this can be achieved by swapping the 2 function calls, ie: first calling the closing bracket and then calling the opening bracket.

if(close > open )
{
Parenthesis(ans+")",close-1,open);
Parenthesis(ans+"(" , close , open-1);
}

Here’s your updated code: https://ide.codingblocks.com/s/583821

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.