1 reply

Replying to @coderbyheart

This approach only solves 4 of the 5 examples, so I have to read a little bit on
what to do different. My solution is using the shortest path, while keeping
track of visited state with the list of collected keys, so fields can be used
multiple times if collected keys change.