Skip to content

Instantly share code, notes, and snippets.

@pakerfeldt
Last active December 7, 2017 09:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pakerfeldt/e673887e7b3ae7e22037382f5999df56 to your computer and use it in GitHub Desktop.
Save pakerfeldt/e673887e7b3ae7e22037382f5999df56 to your computer and use it in GitHub Desktop.
AoC 2017 day 1
List(91212129)
.map(_.toString)
.flatMap(x => x.toList :+ x.charAt(0))
.sliding(2)
.filter { case first :: second :: _ => first == second}
.foldLeft(0){ case (acc, value :: _) => acc + value.asDigit}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment