Advent of Code 2024 Day 1

preview_player
Показать описание
Placed 25/40. 29th overall.

Wow, everyone is fast!
Рекомендации по теме
Комментарии
Автор

My favourite video serie of December is back... Thanks and good luck!

nkeylen
Автор

Amazing watching you resolve this puzzles at this speed, as always. Im happy because my solution was identical as yours. It's only the first of dec, but It means a lot for me since it means I've evolved a lot. In the right way.

BLRMalcolm
Автор

Another december, another AoC. Gl with the leaderboard this year, Jonathan!

Sandborg_
Автор

The king is back. 🎉🎉 look forward to coding along with you this year.

CB
Автор

I got motivation from you and started coding in VIM with bash. Now I can code like you, but can't actually think like you. Hopefully day I'll be thinking as fast as you as well.

umairgillani
Автор

Good night! Damn it's late for you, you have real pressure to solve the harder ones quickly

gupta_samarth
Автор

Two small changes you could make:

LEFT = sorted(LEFT) could simply be LEFT.sort()

There's no need to manually add items to a counter; you could rather use RC = Counter(RIGHT) -- which also makes RC a defaultdict, so then you can use RC[l] to your heart's content.

koosman
Автор

How do you read and understand the questions so fast? Do you have tips on practicing this skill?

ParthPatel-omon
Автор

Your new keyboard is too quiet, I miss the sound of your typing from previous years :-).
Congrats on good start. Btw, Counter by default returns 0 for missing entries so RC[l] would also give the correct result.

amole
Автор

lines_puzzle = open('1.in').readlines()
data = [line.split() for line in lines_puzzle]
# part1
Xs = sorted([int(x) for x, _ in data])
Ys = sorted([int(y) for _, y in data])
print(sum([abs(x-y) for x, y in zip(Xs, Ys)]))
# part2
xs = set(Xs)
print(sum(filter(lambda y: y in xs, Ys)))

rastislavsvoboda
Автор

Total noob question here, but could you point me in the right direction for learning how to navigate the cursor through the code so efficiently like you do here? It's super impressive.

jordanlitko
Автор

It took me ~30 minutes using Python! I'm going for completion this year, all 25. I only got 12 last year before reaching my limit.

MyCipherComplete
Автор

Why exactly do you import defaultdict? What's its purpose?

NeoTheone-rk
Автор

what program are you using to run linux on windows ?

sdemji
Автор

RR = Counter() from collections import defaultdict haha

marttielvisto
Автор

Lol I can only compete on the weekends and still got about 2500th place. Good job getting on the leaderboard.

I didn't think to use Counter for part 2, I just used List.count(arg) multiplied by the value. It's probably faster to execute doing it your way but it still runs instantly for me.

every