Instantly share code, notes, and snippets.

Embed
What would you like to do?
Advent of Groovy code, 2017, day 1
// 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