Yesterday, a lot of you finished quickly and were looking for more to keep you occupied on a Saturday. All of the golfed one-liners were really funny to read through.
The Puzzle
In today’s puzzle, we're helping our fellow passengers fill out customs forms. 26 questions represented by 'a'-'z', and the presence of a particular letter in our input means a "yes" for that question for that particular person. We're just helping tally up the results.
The Leaderboards
As always, this is the spot where I’ll plug any leaderboard codes shared from the community.
Ryan's Leaderboard: 224198-25048a19
If you want to generate your own leaderboard and signal boost it a little bit, send it to me either in a DEV message or in a comment on one of these posts and I'll add it to the list above.
Yesterday’s Languages
Updated 03:07PM 12/12/2020 PST.
Language | Count |
---|---|
Ruby | 3 |
Go | 2 |
Python | 2 |
Haskell | 2 |
JavaScript | 2 |
C | 2 |
Rust | 2 |
COBOL | 1 |
Elixir | 1 |
D | 1 |
TypeScript | 1 |
Merry Coding!
Top comments (28)
OK, today seemed pretty straightforward, although it took me to reach task 2 to have the insight that it was union and then intersect... oh well it is a Sunday :-)
Anyway Haskell was a nice fit and simply used set operations on lists to keep with my somewhat weak goal of using lists.
I've created a step-by-step tutorial (TypeScript) again:
[Advent of Code 2020] Day 6 Step-by-Step Tutorial (TypeScript)
Kai ・ Dec 6 ・ 6 min read
and I did something with bits, just for fun:
Clever solution. I had an instinct that I could use binary to solve Day5, although couldn't quite flesh out a working solution (ended up solving it in a different way). It didn't even dawn on me that you could use binary for this challenge, although it seems obvious now. 👍
Python one-liners, thanks to set theory and list comprehension, and map
Part 1:
Part 2:
I try to explain this more fully at dev.to/meseta/advent-of-code-2020-...
Python impl today. Prob not great python but works.
Tomorrow will try something like prolog?!
Failing that, maybe Haskell.
Ruby, part 2:
Rust!
Ugh, made it too late for this day (but I had it done in time for the problem, honest!).
Used HashSet to my benefit here, as I could apply set theory to the problem and get it done easily.
As always, in Github.
COBOL
2 Solutions again.
Go:
And tweet-sized PHP:
I decided to do this year in Haskell. Perhaps if it gets too crazy, I'll revert to what I know better, but until now it's been fun.
I might start a library with the
groups
andaddAll
functions, seems I'm going to use them for every puzzle...I thought the most obvious way to do this would be to intersect a bunch of HashSets, but seemed to be more short & sweet to just check that every character in the first line was contained in every other line 🤷
Part 1
Part 2
PlaneGroup