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!
Latest comments (28)
Haskell:
Python. A bit less elegant than some of the other python versions already posted but the same idea using set theory
Only took a few minutes today; here is what I got in Ruby:
I spent a long time trying to get a regex to work for part 2, but I have given up for the time being. Got a short couple of answers for this:
Yesterday I had no time to post my solution in Elixir, but there is!
A little late to the party, but I got it done before bed time 😁
Day6.h:
Day6.c:
Ruby, part 2:
Ruby, part 1:
Javascript answer, Part 1 and 2 in one script, change the
part2
boolean to false if you want a part 1 answer.Looking at other people's responses, mine feels very inefficient :(
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-...
Re yesterday: actually my solution was in D, but I don't see it listed in the table.
OK cool, I wasn't 100% sure. I'll update that.
Yeah, I should've mentioned that in the original. Those C-like languages look pretty much all the same if you don't know some particular details.
Haha! Yeah, I was thinking, "I'm pretty sure that's not Go, but maybe it's C#? Or C++?" I just thought of inspecting the HTML classes yesterday after running into a similar issue. 😂
I've solved this using Clojure for the sake of. It seems to be the shortest one so far.
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
JavaScript - I did it in COBOL first, but still wanted to practice reduce a bit.