Advent of Code 2022 Recap
This year was the first one in which I participated in Advent of Code (AoC). I am not sure why I haven't noticed it before. Maybe I was not interested, since coding competitions are not related to my daily work. Additionally, competitions like Google Code Jam require a lot of time and effort.
Nevertheless, my company started an internal competition this year with a private leaderboard, so I wanted to give it a try.
As I already mentioned, AoC is a coding competition. Each day you get a new challenge and unlock a part of the story (which was quite funny). According to Wikipedia the competition started in 2015. So, I am a laggard on the adaption curve it seems. What I couldn't figure out is why exactly Eric Wastl started the whole thing and what qualifies him. Still, he does a good job.
It seems like some people use AoC to learn a new programming language. It seems like a good chance to try a new language on some "real" problems, rather than examples in the books. Though it seems like a good idea, I stuck to my favorite language these days, which is Kotlin. This also gave me a speed advantage in the competition, since I did not have to adjust to a new language. As a bonus, the JetBrains people also discussed all challenges up to day 12. So I could compare my solution to the ones presented there.
What I gave up pretty quickly was a place on the global leaderboard. As I mentioned, I don't know about the previous years, but AI has proven to be a big advantage. After some Twitter research I could see that at least for the first few days AI spit out perfect solutions within minutes. On the one hand that is pretty interesting regarding the advances in AI technology but on the other hand, it destroys the competition. My main goal was to reach first place on my company's leaderboard.
Honestly, I had quite a good run until day 16. I was even placed first for a short period of time. Day 16 proved to be a challenge I could not solve easily. Of course, there is the Reddit board and checking GitHub is also possible. Still, I wanted to find the solution myself. Of course, as in many coding competitions, AoC boils down to algorithms. While a simple solution works in the first few days, the later challenges are too complex for simple solutions. Repeating things like BFS is alright, and I also learned about the Chinese remainder theorem but when things got really difficult I had to give up.
I think many people will agree with me that their time is limited. Hacking one approach for one or two hours is fun. Realizing that it doesn't work out is pretty bad because a rewrite would take nearly the same amount of time (with no guarantee that it'll work this time). While that's a blocker for me others might enjoy the additional challenge.
Nevertheless, although I had to give up, the overall experience was quite fun. The overarching story made me smile and I could repeat some algorithms. Additionally, I learned one or two things.
Things I learned/re-discovery
Just as a short list:
chunked() on a (Kotlin) collection
I don't wanna miss Kotlin ranges
windowed() on a (Kotlin) collection
I hate exercises involving two-dimensional arrays (but became better over time ^^)
Chinese remainder theorem
when it comes to code something fast I tend to rely on imperative programming (for loop, break, continue, vars) not functional one
seeing other people code also helped, sometimes they wrote some beautiful solutions
Next year I will participate again, for sure. Getting up at 6 a.m. German time isn't too bad. And my colleagues should be prepared for me to keep up until the end ;)
Did you find this article valuable?
Support Ronny Bräunlich by becoming a sponsor. Any amount is appreciated!