Module advent::y2017::day1

source ·
Expand description

Inverse Captcha (Statement).

Functions

Review a sequence of digits (your puzzle input) and find the sum of all digits that match the next digit in the list. The list is circular, so the digit after the last digit is the first digit in the list. O(n) with no additional space.
Same as Part 1, but instead of considering the next digit, it wants you to consider the digit halfway around the circular list. O(n) with no additional space.
Read digits from the input.
Use iterator skip and take to setup a pair of shifted iterators over the input to zip over and then filter the required digits to sum up. O(n) with no additional space