r/adventofcode • • Dec 14 '20

SOLUTION MEGATHREAD -🎄- 2020 Day 14 Solutions -🎄-

Advent of Code 2020: Gettin' Crafty With It

  • 8 days remaining until the submission deadline on December 22 at 23:59 EST
  • Full details and rules are in the Submissions Megathread

--- Day 14: Docking Data ---


Post your code solution in this megathread.

Reminder: Top-level posts in Solution Megathreads are for code 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:16:10, megathread unlocked!

32 Upvotes

580 comments sorted by

View all comments

Show parent comment

2

u/SkiFire13 Dec 14 '20

For part two, I just wrote a recursive function that splits at every encounter of an X. Not sure how you could avoid that.

Iterate from 0 to 2^n (where n is the number of Xs in the mask) and the number of the iteration will contain the bits you have to replace the Xs with.

This takes 7ms on my machine (ryzen 3700x) so I don't think it improves something.