r/adventofcode • • Dec 08 '21

SOLUTION MEGATHREAD -🎄- 2021 Day 8 Solutions -🎄-

--- Day 8: Seven Segment Search ---


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:20:51, megathread unlocked!

72 Upvotes

1.2k comments sorted by

View all comments

1

u/goeyj Dec 08 '21 edited Feb 27 '26

[JavaScript]

Originally solved and submitted with a solution that brute forced the permutations, but rewrote to generate the correct permutation rather than generating and cycling through all of them. The code is a little uglier, but it went from 3s to about 30ms runtime.

1

u/daggerdragon Dec 09 '21 edited Dec 10 '21

Please follow the posting guidelines and edit your post to add what language(s) you used. This makes it easier for folks who Ctrl-F the megathreads looking for a specific language.

(looks like JavaScript?)

Edit: thanks for adding the programming language!

1

u/goeyj Dec 09 '21

Fixed. My bad! Was moving a bit too quickly today.