Riley Kong / Posts

Advent of Code 2024

December 1, 2024

Thus begins my journey down the chimney-hole...

After a very rainy Thanksgiving, Boston temps plummeted by a couple dozen degrees; I found myself reaching for my puffer and longing for a cup of hot chocolate. It was the start of winter—and that meant Advent of Code (AoC).

AoC is an Advent calendar for CS nerds. Each day from December 1st to 25th, a new algorithmic problem drops at midnight EST. Participants get stars for solving challenges quickly, and top 100 people earn leaderboard points. It's pretty popular: last year, Day 1 saw more than a quarter million correct submissions recorded.

I'd dabbled in AoC in previous years but had always let it fall by the wayside. This year felt different. I was going to get back into the competitive programming mindset, brush up on C++, and conquer the leaderboard. And by "conquer," I really meant getting first place.

I was partly motivated by jealousy. Sometimes I would take a gander at the leaderboard and find some of my friends listed on the top 100. If they could do that, why couldn't I?

Days 1-2

I was going to solve the first day's challenge before the end of the 1st. Unfortunately I forgot that I would need to go practice my chamber piece with my partner. This lasted until 11:45, and by the time I got back to my dorm room, it was already the second. Oops.

So I solved both days' problems in order. I spent roughly 15 minutes solving the first problem in C++. "Wow," I thought, "maybe I am good at this. Maybe it is my month for C++."

And then the second problem hit, and the first part was okay but annoying. Then I got to the second part and thought "wow this would be so much easier in Python". So I gave up on writing everything in C++, and proceeded to solve it right away in Python.

day 01, pt 1 | >24h     | rank 108820
day 01, pt 2 | >24h     | rank 102728
day 02, pt 1 | 00:58:59 | rank 14018
day 02, pt 2 | 01:48:38 | rank 12692

Day 3

I forgot that a regex existed until roughly 15 minutes into coding, at which point I stopped and solved the first part in a minute. I took a look at a solution on YouTube and read the comments, and realized that groups were actually important in regexing.

day 03, pt 1 | 00:16:59 | rank 7161
day 03, pt 2 | 00:26:55 | rank 5317

Nice! My rank was now a four-digit number.

Day 4

I actually tried today. I typed like the keyboard was on fire, barely pausing between keystrokes. But my results were pretty mid.

I wanted this to be an advent calendar, where you open each little box and savor the chocolate inside. I needed to stop comparing myself to those people if I wanted to have a shot at even enjoying this experience.

This was too stressful. I wasn't learning anything but how to feel more stressed coding. I didn't want to have to do little things like set up automated scripts to scrape the input text or write custom macros for certain functions. Would the clout received from getting onto the leaderboard actually outweigh the enjoyment I received from this?

day 04, pt 1 | 00:07:20 | rank 1019
day 04, pt 2 | 00:12:50 | rank 685

Day 5

I read these three blogs. I think my goal shouldn't be to get on the leaderboard, but rather to learn.

I did a couple minutes worse time-wise than yesterday. I'm going to stop reporting times, because it's getting annoying and frankly un-fun.

day 05, pt 1 | 00:09:12 | rank 1124
day 05, pt 2 | 00:14:45 | rank 869

From now on I think I'll challenge myself to