Unable to load image
Reported by:

rDrama Advent of Code Day 1: Warm up

I hope this fine morning finds you well, saars.

The word of the day is collections.Counter

The rdrama leaderboard invite code is 632268-30587026

I created the ping group: !AOC, I'm sure it will be useful offseason too.

Charts! https://github.com/jeroenheijmans/advent-of-code-charts

19
Jump in the discussion.

No email address required.

Solution:

    lst1, lst2 = [], []
    for s in data:
        a, b = s.split()
        lst1.append(int(a))
        lst2.append(int(b))
    lst1.sort()
    lst2.sort()
    if not second:
        return sum(abs(a - b) for a, b in zip(lst1, lst2))
    lst2 = Counter(lst2)
    return sum(x * lst2[x] for x in lst1)
Jump in the discussion.

No email address required.

how long did u take Spider :marseything2:

Jump in the discussion.

No email address required.

https://i.rdrama.net/images/17330344433960865.webp

@Platy why do we have two of you o_O

Jump in the discussion.

No email address required.

ur so smart :marseyidiotsavant: hearts

Jump in the discussion.

No email address required.

moved from reddit to a shell github account

Jump in the discussion.

No email address required.

Link copied to clipboard
Action successful!
Error, please refresh the page and try again.