Advent Of Code Day 20 - Solution explained by Achim in Java #aoc

preview_player
Показать описание
Grove Positioning System.
Solution explained by Achm
#aoc
Рекомендации по теме
Комментарии
Автор

Thank you for your explanation of your aoc solutions, they are very helpful, especially day19!

An alternatve to using a linked list is to not actually move the numbers around, but just define a permutation datastructure in terms of two lookup tables: and map_current_to_original[input.length], then implement a swap(permutation, a, b) that updates both arrays in constant time. Runs in under a second
Then you can simply iterate over the original positions and update the current positions via swap()

LaszloKorte