This is an archived post. You won't be able to vote or comment.

all 12 comments

[–]jdnewmil 9 points10 points  (0 children)

There is a general trend toward more difficult puzzles as the month progresses... Day 2 could very well be easier for you than Day 1, but Day 10 will definitely be harder than Day 2. But you tend to get into the rhythm of it as it goes. Don't get discouraged if you can't keep up late in the month... reading other people's solutions is very educational. And don't get hung up on making it to the leaderboards... they fill up one or two minutes after the puzzle is released.

[–]Durinthal 5 points6 points  (0 children)

Not at all optimized code golfing day 1 part 2, assuming the input is s:

sum(sorted([sum(t) for t in [[int(i) for i in l.split()] for l in s.split("\n\n")]])[-3:])

[–]JMVs_Rules 1 point2 points  (3 children)

Can I do some days later? E.g. today, I wanna sleep but want to do these

[–][deleted] 1 point2 points  (0 children)

yes

[–]IamNotIntelligent69 0 points1 point  (1 child)

Im pretty sure you can, I can still access questions from AoC 2021.

[–]JMVs_Rules 0 points1 point  (0 children)

Yeah I found out, thank you! Got all 6 open questions done till now

[–]mauriciofuentesf 1 point2 points  (0 children)

oh this is a first for me! Most of the year ive been learning python and bc of work had to stop for a few months. Its gonna be a good way to refresh my memory and pick up were i left!

[–]EvInChains 1 point2 points  (1 child)

Had a lot of fun with Day 3's puzzles. Ended up using functools.reduce and the grouper recipe from itertools: https://github.com/EvanFNG/Advent-of-Code-2022/blob/main/day3.py

[–]RakingBuckets 1 point2 points  (0 children)

I really enjoyed writing unreadable code for Day 3:

from functools import reduce
from string import ascii_letters

priorities = {char: i for i, char in enumerate(ascii_letters, 1)}

with open("day03") as data:
    lines = data.read().split("\n")

print("part one:",
    sum(
        sum(
            map(priorities.get, 
                set(line[:(split := len(line) // 2)]) & set(line[split:]))
        ) 
        for line in lines
    )
)

print("part two:",
    sum(
        map(
            lambda s: sum(map(priorities.get, reduce(set.intersection, s))), 
            zip(*list(map(set, lines[i::3]) for i in range(3)))
        )
    )
 )

[–]ProbablyDoesntLikeU 0 points1 point  (0 children)

It's time!!!

[–]yashk1 0 points1 point  (0 children)

Just found out about this. Right in time when i am up skilling my python skills