Vigyata.AI
Is this your channel?

ADVENT OF CODE 2024 | Day 1 Jackie's Python Solution

15.0K views· 598 likes· 5:15· Dec 3, 2024

How did you solve Day 1? Leave a comment below, like and subscribe :) #adventofcode #vlogmas #programming

About This Video

I spontaneously decided to give Advent of Code a shot this year, and for Day 1 of Advent of Code 2024 ("Historian Hysteria"), I walked through my full Python approach for both parts of the puzzle. The story setup is this fun mix of math and mystery: a chief historian employed by Santa goes missing, and we’re comparing two lists of location IDs to help the elves figure out where he might have gone. I can’t promise I’ll post every single day because I’m juggling a demanding full-time job (and a year-end deadline), but I’m doing my best to keep filming and sharing my solutions. For Part 1, I read the input into two lists, sorted both lists, paired smallest-to-smallest, and summed the absolute differences to get the total distance. My final answer for that part was 2285373. For Part 2, I computed a similarity score by building a hashmap of number occurrences in the second list, then iterating through the first list and summing each number multiplied by its count in list two (e.g., if 3 appears three times, it contributes 9). That gave me 21142653, and it was also correct. If you’re participating, I’d genuinely love to hear how you approached it too.

Frequently Asked Questions

🎬 More from CS Jackie