Last active
December 7, 2017 09:38
-
-
Save pakerfeldt/e673887e7b3ae7e22037382f5999df56 to your computer and use it in GitHub Desktop.
AoC 2017 day 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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