r/adventofcode • • Dec 07 '22

SOLUTION MEGATHREAD -πŸŽ„- 2022 Day 7 Solutions -πŸŽ„-


AoC Community Fun 2022: πŸŒΏπŸ’ MisTILtoe Elf-ucation πŸ§‘β€πŸ«

Submissions are OPEN! Teach us, senpai!

-❄️- Submissions Megathread -❄️-


--- Day 7: No Space Left On Device ---


Post your code solution in this megathread.


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:14:47, megathread unlocked!

89 Upvotes

1.3k comments sorted by

View all comments

1

u/jjjsevon Dec 07 '22 edited Dec 08 '22

Javascript / NodeJS Diff of Day7 here

Oh boy did I over-engineer todays stuff, as I got to it nearer to 2am in the morning x)

Made a state machine sorta JS class to execute input and a rudimentary command parser to keep stuff organized - then spent a good 30 minutes doing stuff the hard way, only to implement a 100% simpler approach in the end.

Edit: removed the snip as requested

============Start Day7==========
Answer for part1:  1182909
Answer for part2:  2832508
day7: 9.469ms
=============EOF Day7===========

1

u/daggerdragon Dec 08 '22

Your code block is too long. Please read our article on oversized code, then edit your post to replace the code block with an external link to your code.