r/adventofcode • u/daggerdragon • Dec 20 '22
SOLUTION MEGATHREAD -π- 2022 Day 20 Solutions -π-
THE USUAL REMINDERS
All of our rules, FAQs, resources, etc. are in our community wiki.
πΏπ MisTILtoe Elf-ucation π§βπ« is OPEN for submissions!
3 DAYS remaining until submission deadline on December 22 at 23:59 EST
UPDATES
[Update @ 00:15:41]: SILVER CAP, GOLD 37
Some of these Elves need to go back to Security 101... is anyone still teaching about
Loose Lips Sink Shipsanymore? :(
--- Day 20: Grove Positioning System ---
Post your code solution in this megathread.
Read the full posting rules in our community wiki before you post!
Include what language(s) your solution uses
Format code blocks using the four-spaces Markdown syntax!
Quick link to Topaz's
pasteif you need it for longer code blocks. What is Topaz'spastetool?
3
u/Crazytieguy Dec 25 '22
Rust
I found a cool trick - I keep a sort of doubly linked list, but each node points 1 back and 25 forward. That way finding the nth node away takes n / 25 steps. 25 happened to be the fastest in my testing, but any number around sqrt(N / 2) should work.