Comments

redundant District9 months ago

const solve = (strOne, strTwo) => { var final = []; var arrOne = strOne.split(''); var arrTwo = strTwo.split(''); for(var i = 0; i < arrTwo.length; i++){ arrOne.forEach((value, index) => { if(value == arrTwo[i]){ final.push(arrOne.splice(index, 1)) } }) } final.push(arrOne); var last = final.flat().join('') return last; };