Skip to content

Instantly share code, notes, and snippets.

@Dierk
Created December 2, 2017 22:45
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 Dierk/611d113040ce34bbabdfb43f3820fca0 to your computer and use it in GitHub Desktop.
Save Dierk/611d113040ce34bbabdfb43f3820fca0 to your computer and use it in GitHub Desktop.
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