Created
December 2, 2017 22:45
-
-
Save Dierk/611d113040ce34bbabdfb43f3820fca0 to your computer and use it in GitHub Desktop.
Advent of Groovy code, 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
// http://adventofcode.com/2017/day/1 | |
def captcha(list) { | |
def last = list[-1] | |
def clean = list.findAll { e -> | |
if (e == last) { | |
last = e; true | |
} else { | |
last = e ; false | |
} | |
}.sum() | |
} | |
captcha("1122".collect{it.toInteger()}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment