I just rewrote my idea with clear names instead of convulted offsets and it came out ok...
I just rewrote my idea with clear names instead of convulted offsets and it came out ok...
Inserting and keeping an index isn't fun, huh?
Inserting and keeping an index isn't fun, huh?
Parsing time: 993.583µs
Part 1 took: 896.542µs
Part 2 took: 766.808708ms
Total time: 767.838667ms
Visited: 4580
Loops: 1480
Parsing time: 993.583µs
Part 1 took: 896.542µs
Part 2 took: 766.808708ms
Total time: 767.838667ms
Visited: 4580
Loops: 1480
I don't know why the word 'sort' didn't make me think of using the std sort function. I'm just learning Go with AoC 😅
I don't know why the word 'sort' didn't make me think of using the std sort function. I'm just learning Go with AoC 😅
1. Create three aux data structures to hold the incremental results.
2. When I found an issue, I switched values (X|Y to Y|X) for the conflicting parts, and resumed computing from lower position.
I had the partial results, so I didn't need to restart for each change.
1. Create three aux data structures to hold the incremental results.
2. When I found an issue, I switched values (X|Y to Y|X) for the conflicting parts, and resumed computing from lower position.
I had the partial results, so I didn't need to restart for each change.