You are viewing a single comment's thread. Return to all comments →
My Javascript solution:
function makeAnagram(a, b) { let remainingCharacters = []; for(let i = 0; i < a.length; i++) { let found = false; for(let j = 0; j < b.length; j++) { if(a[i] === b[j]) { found = true; b = b.slice(0, j) + b.slice(j + 1); break; } } if(!found) { remainingCharacters.push(a[i]); } } remainingCharacters = remainingCharacters.concat(b.split('')); return remainingCharacters.length; }
Seems like cookies are disabled on this browser, please enable them to open this website
Strings: Making Anagrams
You are viewing a single comment's thread. Return to all comments →
My Javascript solution: