Advent of Code 2024 is starting!
Advent of Code 2024 is starting! I did the first day while hanging out with jan Tepo; you can see the video here (it is in toki pona instead of English like usual). I got 22nd for the first part and 11th for the second part.
I'm feeling pretty nervous about the month. I want to minimize silly mistakes, but that's also going to cost me time (see my day 1 video for that!), and I'm not sure if I'm as familiar with my setup as I should be.
Anyway, we'll see how it goes. Here's my day 1 solution from my GitHub repo:
Day 1 solutions in JS + utilities library
function day1(input, part2) {
let columns = input.posints().splitEvery(2).transpose()
if (part2) {
return columns[1].int(new Set(columns[0])).sum()
} else {
return columns.map((c) => c.sortNumAsc()).transpose().sum(([a, b]) => Math.abs(a - b))
}
}
The part 2 solution assumes no duplicates in the left column, which is silly, but I just really like not having any multiplies.
If there's ever anything particularly interesting from an AoC problem I feel like talking about, I might make further posts here. That's it for now, though!