# Better check required

Tell us what’s happening:

There are multiple answers to this problem. please use eval to find the correct answer

Your code so far

function solve24 (numStr) {
// Good luck!
//thank you
//let num = 2222;
//while(num<2250){

//numStr=num.toString();
console.log('q: '+numStr);
let arr = getall(numStr,0,numStr.length);
//console.log(arr);
let signs = getall('+-*/',1,3);
//console.log(signs);

let barray=[['(','',')','','',''],['(','',')','(','',')'],['(','','','',')',''],['','(','','',')',''],['','(','','','',')'],['','','','(','',')'],['','','','','','']];
let farray =[];
let ans='';
arr.map(u=>{
let go = true;
if(true){
signs.map(v=>{

barray.map(w=>{
let calc;
if((v.indexOf('*')==-1&&v.indexOf('/')==-1)||(v[0]==v[1]&&v[1]==v[2])){
calc = [u[0],v[0],u[1],v[1],u[2],v[2],u[3]];
}else{
calc = [w[0],u[0],v[0],w[1],u[1],w[2],v[1],w[3],u[2],w[4],v[2],u[3],w[5]];
}
let calcstring = calc.join('');
//console.log(calcstring);
if(eval(calcstring)==24){
if(farray.indexOf(calcstring)==-1){
farray.push(calcstring);
console.log('ans'+calcstring);
}
ans=calcstring;
go=false;

return calcstring;
}

});
});
}
});

//return ans;
console.log('no of ways to solve: '+farray.length);
return ans;
//num++;
//}
}

function getall(numStr,style,max){
numStr=numStr.split('');
let nStr = Array(numStr.length).fill(0,0).map((u,i)=>u=i).join('');
//console.log(nStr);
let arr=nStr.split('').map(u=>u=[u]);
let oarr=nStr.split('');
let ct = 0;
let oarray;
while(ct<max-1){
let farray=[];
//console.log(arr);
let narr=arr.map(v=>{
if(style==0){
}else{
}

return v;
});

arr=farray;

ct++;
}

let numarr = arr.map(u=>{
return u.map(v=> {
return numStr[parseInt(v)];
});
});

return numarr;
}

//

//

//