Fork me on GitHub

Does anyone have a good answer to (Part 1)? It's the one with the maze, keys and doors. I can't seem to get it down to a reasonable time.


Haven't tried it, so I'm not 100% sure, but you might be able to reduce this to a shortest path problem which is O(nlogn). I don't know if that will get you to subsecond performance though (depends on the size of the input)