Skip to content

Instantly share code, notes, and snippets.

@smiled0g
Last active June 29, 2018 01:27
Show Gist options
  • Save smiled0g/c366aa01874e66a211df61bd7e90a78f to your computer and use it in GitHub Desktop.
Save smiled0g/c366aa01874e66a211df61bd7e90a78f to your computer and use it in GitHub Desktop.
function anagram(lp, word) {
const m = lp.reduce((o, w) => Object.assign(o, {[w]: (o[w] || 0)+1}), {})
return !word.split('').some(c => !m[c]--)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment