Hello, there and welcome to my Advent of Code 2020 Day 9 cruise log. Today was fun, kinda reminds of some whiteboard interview questions. Find the number that matches this or that property based on other numbers in a suite. Nothing insane if you’ve seen that shape of problem before. If not then it can be tricky to solve but otherwise easy stuff.
As you may notice, there is no such thing as easy when you wake up at 4.20 am for AoC. Or for anything else, really. Heck, I tried to take a sip of water before starting and I spilt it on my tank top. Even though I fought my foggy brain with the power of the loudest Spotify songs I could find.
Similarly to this missed sip of water exploiting the weakness of my awakening, today we had to exploit a weakness in the XMAS cypher. Here, XMAS stands for eXchange-Masking Addition System. Finding names to match intersting accronyms is hard, ask the APOIL people.
Back to the problem, really nothing noteworthy happened there. I wrote an empty implementation, then tests, tests failed. Then I actually implemented my part one and the tests passed. After that I did the same for part two, tests kept failing. This marked the return of the foggy brain as I was testing the method from part one expecting the result for the final part. After a few minutes wondering what was wrong with my code, I figured the test was erroneous. As soon as I used the right method, the tests passed. I run my input, it goes through instantly despite the suspiciously high number and I drop my usual victory tweet.
Search algorithms are fun but I feel like had my brain been more awake I would have completed this way faster. Lots of brain lag at 5 am but at last, I completed "Encoding Error" – Day 9 – Advent of Code 2020 https://t.co/V5Du08VYGn #AdventOfCode pic.twitter.com/TZc9RuT109— Jean-Dominique Nguele (@CodingNagger) December 9, 2020
Thank you for reading my Advent of Code 2020 Day 9 cruise log, I will see you tomorrow, maybe. In the meantime, you can check out my Go Cloud series about building and deploying a Golang app to AWS. Also, I will push my code on Github at CodingNagger/advent-of-code-2020 so feel free to check it out but not before you’ve done the challenge yourself. Bye!