aoc-2020-zig

Advent of Code 2020 Solutions in Zig
git clone https://git.sinitax.com/sinitax/aoc-2020-zig
Log | Files | Refs | README | sfeed.txt

part2 (885B)


      1--- Part Two ---
      2
      3The final step in breaking the XMAS encryption relies on the invalid number you just found: you must
      4find a contiguous set of at least two numbers in your list which sum to the invalid
      5number from step 1.
      6
      7Again consider the above example:
      8
      935 20 15 25 47 40 62 55 65 95 102 117 150 182
     10127 219 299 277 309 576
     11
     12In this list, adding up all of the numbers from 15 through 40 produces the invalid number from step
     131, 127. (Of course, the contiguous set of numbers in your actual list might be much longer.)
     14
     15To find the encryption weakness, add together the smallest and
     16largest number in this contiguous range; in this example, these are 15 and 47,
     17producing 62.
     18
     19What is the encryption weakness in your XMAS-encrypted list of numbers?
     20
     21