#include
using namespace std;
void generate_bracket(char * out,int n,int idx,int open,int close){
//base case
if(idx==(2*n)){
out[idx]=’\0’;
cout<<out<<endl;
}
// recursive case-2 option
if(open<n){
out[idx]=’(’;
generate_bracket(out,n,idx+1,open+1,close);
}
if(close<open){
out[idx]=’)’;
generate_bracket(out,n,idx+1,open,close+1);
}
return;
}
int main() {
int n;
cin>>n;
char out[1000];
int ind=0;
generate_bracket(out,n,0,0,0);
return 0;
}
this is my code but it not pass the test case please tell what is the problme in it