Skip to content

Instantly share code, notes, and snippets.

@amwmedia
Last active December 8, 2017 14:47
Show Gist options
  • Save amwmedia/4320f4205b6844983261b005b61f143c to your computer and use it in GitHub Desktop.
Save amwmedia/4320f4205b6844983261b005b61f143c to your computer and use it in GitHub Desktop.
Advent Of Code 2017 - Day 4
// input is array of passphrases
input.filter(
phrase => phrase
.split(' ')
.every((word, idx, arr) => arr.indexOf(word) === idx)
).length;
// input is array of passphrases
input.filter(
phrase => phrase
.split(' ')
.map(word => word.split('').sort().join(''))
.every((word, idx, arr) => arr.indexOf(word) === idx)
).length;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment