53
SOLUTION MEGATHREAD-🎄- 2019 Day 4 Solutions -🎄-(self.adventofcode)
submitted 6 years, 1 month ago* (edited 7 minutes after) by daggerdragon to /r/adventofcode (134.8k)
since 6 years, 1 month ago
3 of 3
Tip Reveddit Real-Time can notify you when your content is removed.
your account history
Tip Check if your account has any removed comments.
view my removed comments you are viewing a single comment's thread.
view all comments


Python, 1042/3178
Well after looking at this forever because of how many times I got part 2 wrong, I noticed two things
a) If you simply sort digit-wise and compare and they're not the same, that eliminates it
b) If it wasn't eliminated in a), that means that you just need to count the occurrences of the digits to see if it's still legit
Although this isn't my actual code, it's just the super short version with a comment for part 1/2, here we are:
It's super clean and really easy to see what exactly is going on, though it took me a while to figure it out, I'm happy with it. Very clever puzzle.
That's really clever, didn't think of that. If I'm not mistaken though, that wouldn't work for part 2. If you had say 222345, you'd still get a hit even though it shouldn't.