You are viewing a single comment's thread. Return to all comments →
Short javascript version
function makingAnagrams(s1, s2) { let cnt = {}; [...s1].forEach(v => { cnt[v] = (cnt[v] || 0) + 1 }); [...s2].forEach(v => { cnt[v] = (cnt[v] || 0) - 1 }); return Object.values(cnt).reduce((a, v) => a + Math.abs(v), 0); }
Seems like cookies are disabled on this browser, please enable them to open this website
Making Anagrams
You are viewing a single comment's thread. Return to all comments →
Short javascript version