Solving for the Largest Summation of Numbers - Advent of Code 2022 Day 01

preview_player
Показать описание
Attempting the 24 days of advent code this year - come along for the journey and learn some code! We'll be using Python for the initial algorithms, and if I have time I'll be redoing them in Rust (on my github profile, link below)

Get caught up on those socials to know when the next video drops:

Рекомендации по теме
Комментарии
Автор

Thanks for tackling the Advent of Code this year. For future problems, please up your browser and editor font sizes by a lot for the video if possible!

Andypro
Автор

Nice. Good luck. The real challenge is doing it everyday and not getting busy with other things. haha

silicalnz
Автор

Nice solution! As a final year Com Sci student, I have never heard of the Advent of Code lol. I have finals starting on Monday so I don't think I will have time to solve it myself but at least I can give thoughts as to how I would solve the problem when I watch your videos.

For the second part of the question, alternatively I would have an array initialized with 3 zeroes (basically [0, 0, 0]) and everytime we get an elf's total, we would add it to the array, sort the array and then I would slice the list for the first three largest elements (lst[:3]). Then at the end, just sum the list. I don't know if it's a more efficient solution but I think it's cool that if they asked for the n largest totals then all we would have to do is replace lst[:3] with lst[:n] (and replace [0, 0, 0] with lst = [0] * n)

ChampionJan
Автор

Haha, I'll be doing it alongside you! Thanks for posting about it by the way, I'd never heard of it before you posted last year and then you reminded me again that it existed this year. Interested to see what solutions you come up with :)

fireflysparkava
Автор

I wonder if you'd want to set up a private leaderboard for you and your viewers to compare progress. You'd probably want to use the Stars ordering (which ranks based on stars collected, breaking ties by the time of the most recent star collected) rather than the others as people won't all be starting at the same time.

patrickhogg