Expand description
§A Regular Map
Simple solution taking advantage of a controversial property of the input. After taking any branch it’s assumed that we can return to the pre-branch position. This does not hold for general inputs, as it’s easy to construct paths which violate this constraint.
We use a stack to save the position before a branch, pushing whenever an opening (
is
encountered then popping whenever the closing )
is found. Additionally we assume that
the location will never move more than 55 rooms from the starting location in order to use
a fixed size array to hold the minimum distance to any room.
Functions§
- explore 🔒
Type Aliases§
- Input 🔒