You are viewing a single comment's thread. Return to all comments →
Javascript (Typescript)
function makingAnagrams(s1: string, s2: string): number { let str1: string = s1; let str2: string = s2; for(let i = 0; i < str1.length; i++) { let index = str2.indexOf(str1[i]); if(index !== -1) { str1 = str1.substring(0, i) + str1.substring(i + 1); str2 = str2.substring(0, index) + str2.substring(index + 1); i--; } } return str1.length + str2.length;
}
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 →
Javascript (Typescript)
}