For example, with elements a,b,c,d, there are 5 possible ways to take neighboring elements and reduce them into a single element, where exactly two elements mus
And, here is some C++ code for the same :
bool is_a_solution( string partial,int n,int k) {
if(partial.length() == n*2 )
return true;
return false;
}
string constructCandidate(int n,string input,string partial, int k) {
int xcount=0,ycount=0;
int count;
int i;
string candi;
if(k == 0)
return string("(");
else {
for(i=0;i