You are viewing a single comment's thread. Return to all comments →
Thank you to the contribution. I just did some things to increase de legibility of it:
function countLesserAnagram(word1, word2) { var frequency = {}; word1.forEach(char => frequency[char] = (frequency[char] || 0) + 1); word2.forEach(char => frequency[char] = (frequency[char] || 0) - 1); return Object.keys(frequency).map(key => Math.abs(frequency[key])).reduce((a,b) => a + b); }
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 →
Thank you to the contribution. I just did some things to increase de legibility of it: