r/adventofcode • u/daggerdragon • Dec 03 '18
SOLUTION MEGATHREAD -🎄- 2018 Day 3 Solutions -🎄-
--- Day 3: No Matter How You Slice It ---
Post your solution as a comment or, for longer solutions, consider linking to your repo (e.g. GitHub/gists/Pastebin/blag or whatever).
Note: The Solution Megathreads are for solutions only. If you have questions, please post your own thread and make sure to flair it with Help.
Advent of Code: The Party Game!
ATTENTION: minor change request from the mods!
Please prefix your card submission with something like [Card] to make scanning the megathread easier. THANK YOU!
Card prompt: Day 3 image coming soon - imgur is being a dick, so I've contacted their support.
Transcript:
I'm ready for today's puzzle because I have the Savvy Programmer's Guide to ___.
This thread will be unlocked when there are a significant number of people on the leaderboard with gold stars for today's puzzle.
edit: Leaderboard capped, thread unlocked!
41
Upvotes
View all comments
Show parent comment
1
u/rabuf Dec 03 '18
Thanks. I realized later on that I didn't need to keep the list of all IDs at each point like in my Part 2 solutions since the second loop just checks that the length is > 1 or not. The equivalent loop would just be a check on the array created in Part 1 and check if a cut had all 1s in its range. But it was 12:30 when I wrote that, so I'm happy I only had one bug the first time through.
I had the first loop run
for i from left below widthrather thanfor i from left below (+ left width). And a similar error on the inner loop.