You are viewing a single comment's thread. Return to all comments →
Here is my JS solution:
let ar2 = s2.split(``); let ab = Math.abs(s1.length - s2.length); for(let i = 0; i < s1.length; i++){ let id = ar2.indexOf(s1.charAt(i)); if(id !== -1){ ar2.splice(id, 1); } } return (s1.length<s2.length) ? (ar2.length-ab) * 2 + ab : (ar2.length) * 2 + ab;
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 →
Here is my JS solution: