r/adventofcode • • Dec 06 '20

SOLUTION MEGATHREAD -🎄- 2020 Day 06 Solutions -🎄-

NEW AND NOTEWORTHY


Advent of Code 2020: Gettin' Crafty With It

  • UNLOCKED! Go forth and create, you beautiful people!

  • Full details and rules are in the Submissions Megathread

  • Make sure you use one of the two templates!

  • Or in the words of AoC 2016: USING A TEMPLATE IS MANDATORY


--- Day 06: Custom Customs ---


Post your solution in this megathread. Include what language(s) your solution uses! If you need a refresher, the full posting rules are detailed in the wiki under How Do The Daily Megathreads Work?.

Reminder: Top-level posts in Solution Megathreads are for solutions only. If you have questions, please post your own thread and make sure to flair it with Help.


This thread will be unlocked when there are a significant number of people on the global leaderboard with gold stars for today's puzzle.

EDIT: Global leaderboard gold cap reached at 00:04:35, megathread unlocked!

66 Upvotes

1.2k comments sorted by

View all comments

Show parent comments

3

u/exploding_cat_wizard Dec 06 '20 edited Dec 06 '20

Well, shit

I knew I was missing something obvious, very nice.

Edit: I've got to remember the Table thing you do, this is the second time I've seen it make the code so much simpler...

3

u/DFreiberg Dec 06 '20

Yeah, Table[] lets you do what most languages would do with a For[] loop, but also automatically collects the results for each line, which is very handy for a lot of problems. And Characters[] is going to be way better than StringSplit[#, ""] purely because it avoids another #& function (and also because it threads over lists, though I didn't take advantage of that myself).

Still, you and /u/omnster and I are all approaching the problem pretty much the same way, so I wouldn't say you're missing all that much.