3 ms·
There is a mistake in the article's statement of the problem. It says > the possible moves are going right, down or up by one but the actual problem (https://
by hddqsb 5y ago
There is a mistake in the article's statement of the problem. It says
> the possible moves are going right, down or up by one
but the actual problem (https://adventofcode.com/2021/day/15 https://adventofcode.com/2021/day/15) allows moving in all four directions.
The difference is significant — the naïve attempt described in the article does not work on the actual problem.
The problem as stated in the article is actually quite interesting. The case where the only possible moves are down and right has a standard dynamic programming solution. A variation moving up is also allowed. The time complexity is O(n^2) where n is the grid size, which is faster than using Dijkstra's algorithm.
And regarding the title, I am glad you changed it, but I'd prefer something more similar to the article's new title, such as "Speeding up an Advent of Code solution with Dijkstra's". (At the time of writing, the HN title is "Finding an optimal shortest path algorithm", which doesn't provide much information, and the article's title is "Speeding up my AoC solution by a factor of 2700 with Dijkstra's".)
- siraben 5y ago> The difference is significant — the naïve attempt described in the article does not work on the actual problem. Thanks! I'll update the article to say this. > And regarding the title, I am glad you changed it... Hopefully dang sees this. After a certain amount of time, the title of submissions cannot be changed (I didn't make the most recent changes.)
- hddqsb 5y ago[Edit: The gibberish sentence "A variation moving up is also allowed." was meant to say "A variation of this solution can be used to solve the case where moving up is also allowed."]