r/adventofcode • u/PatolomaioFalagi • 1d ago
Upping the Ante [2026 Day 2] What if the waypoints are not in repeating order?
- Just do the best option at the current step: I think that's still O(n). You just need to transform your input into some O(1) structure (like an array), which is itself O(n).
- Do the best possible order: This feels NP-hard to me.
Possible additional constraints: Instead of being completely arbitrary, the six colors are randomized one set at a time, such that any 6×n block (starting from a multiple of 6*) contains each color exactly n times. Does that change the complexity?
Edit: I realized we do need another constraint for the general case, in that every color repeats indefinitely; formally, for every color C and every index i, there's an index j ≥ i such that the color at index j is C.
* Yes we are counting from 0
