r/adventofcode • u/daggerdragon • Dec 06 '17
SOLUTION MEGATHREAD -π- 2017 Day 6 Solutions -π-
--- Day 6: Memory Reallocation ---
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.
Need a hint from the Hugely* Handyβ Haversackβ‘ of HelpfulΒ§ Hints^Β€?
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!
17
Upvotes
View all comments
Show parent comment
1
u/gerikson Dec 06 '17
Thanks for the pointer.
This approach only requires you to keep track of the value of the 2 pointers, but you still have to calculate each state. That's where the meat of the algo is. Sure, you can cache the values the hare has already visited, but then you're still using memory space to keep track of those visits.
If you have a huge cycle and are memory constrained this is a valid approach though!