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

ACI image

ACI.dev: The Only MCP Server Your AI Agents Need

ACI.dev’s open-source tool-use platform and Unified MCP Server turns 600+ functions into two simple MCP tools on one server—search and execute. Comes with multi-tenant auth and natural-language permission scopes. 100% open-source under Apache 2.0.

Star our GitHub!

Top comments (0)

Image of Quadratic

Free AI chart generator

Upload data, describe your vision, and get Python-powered, AI-generated charts instantly.

Try Quadratic free

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, cherished by the supportive DEV Community. Coders of every background are encouraged to bring their perspectives and bolster our collective wisdom.

A sincere “thank you” often brightens someone’s day—share yours in the comments below!

On DEV, the act of sharing knowledge eases our journey and forges stronger community ties. Found value in this? A quick thank-you to the author can make a world of difference.

Okay