Skip to content

Instantly share code, notes, and snippets.

@evolutionxbox
Last active April 6, 2016 15:18
Show Gist options
  • Save evolutionxbox/4b15ce698989728339831f5678faf05c to your computer and use it in GitHub Desktop.
Save evolutionxbox/4b15ce698989728339831f5678faf05c to your computer and use it in GitHub Desktop.
Given a string `s`, determine whether or not it is possible to rearrange the letters in the string to make a palindrome. (Post manual "uglify")
CanMakePalindrome = (s, b, o, t) => {
t = s.length % 2;
o = [...s].filter(l => {
b = s.split(l);
s = b.join``;
return (b.length - 1)%2;
});
return t ? (o.length === 1) : (o.length === 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment