You are viewing a single comment's thread. Return to all comments →
Here's my JS solution:
if(s.length%2 !== 0){ return -1; } let sub = s.substring(0, s.length * 0.5).split(``); for(let i = sub.length; i < s.length; i++){ let id = sub.indexOf(s.charAt(i)); if(id !== -1){ sub.splice(id,1); } } return sub.length;
Seems like cookies are disabled on this browser, please enable them to open this website
Anagram
You are viewing a single comment's thread. Return to all comments →
Here's my JS solution: