DEV Community

Cover image for Advent of Code 2024 - Day 18: Ram Run
Grant Riordan
Grant Riordan

Posted on

1

Advent of Code 2024 - Day 18: Ram Run

Day 18: Ram Run

solution here

Todays challenge was another shortest path first exercise, so once again cracked out Dijkstra algorithm from Day 16.

With a few tweaks and adjustments around costings and such as the costings were more straight forward as every movement was the same price.

Part 1

I began by filling in the corrupted locations, which then gives the terrain for finding the best route using Dijkstras algorithm. Returning the lowest amount of steps.

Part 2

Loop over the input and for each additional corruption check if you can reach the exit.

This could be optimised to work in reverse as we know it’s more likely to occur when more corruptions are added than at the beginning (but that would be a big assumption, and may not be the case for all inputs as in Part 1 we only ran the first 1024 bytes out of 3k+.

As always feel free to reach out on Twitter

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs