Tell us what’s happening:
Hi,
I’m failing tests 3 to 8 despite my function returning the expected value for all cases (including the empty string). The only difference I see is that elements in my array have single quotes as compared to the double quotes in the examples. I doubt if that could be the cause of the problem.
Your code so far
function permuteString(str, pref, result) {
if (str.length === 0){
result.push(pref)
return result
} else {
for (let j=0; j< str.length; j++){
permuteString(str.slice(0,j)+str.slice(j+1), pref+str[j], result);
}
}
return Array.from(new Set(result))
}
console.log(permuteString("far","",[]))
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.2 Safari/605.1.15
Challenge Information:
Build a Permutation Generator - Build a Permutation Generator