CODE GIVING RIGHT OUTPUT.BUT TEST CASES STILL SHOWING WRONG

#include
#include<bits/stdc++.h>
using namespace std;

vector v;

void generate_brackets(char output[],int n,int i,int copen,int cclose)
{
if(i==2*n)
{
output[i]=’\0’;
v.push_back(output);
return;
}

if(copen<n)
{
    output[i]='(';
    generate_brackets(output,n,i+1,copen+1,cclose);
}

if(cclose<copen)
{
    output[i]=')';
    generate_brackets(output,n,i+1,copen,cclose+1);
}

}

int main()
{
int n;
cin>>n;

char output[100];
generate_brackets(output,n,0,0,0);
sort(v.begin(),v.end());
for(int i=n-1;i>=0;i--)
{
    cout<<v[i]<<endl;
}

}

hi @Mukul-Shane-1247687648773500,
while printing write i = v.size()-1 not n-1

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.