Algorithm: Shortest path (walk) with keys and doors
This other question about mazes is closely related. It deals with the simpler problem of having to collect each of the items before leaving the maze. One can make the analogy that there is a single door at the end of the maze, but it has a very complicated lock and you must collect all the keys to get through it.

The complexity depends on the structure of the maze. In particular, my answer to the other question proves that, if the maze is a general graph, the collect-all-the-items version of the problem is NP-complete and, in fact, the same holds for planar graphs.  This means that your problem is also NP-complete on general (or planar) graphs.  Here's a sketch of the reduction.  You simulate the door with the complicated lock by replacing the exit to the maze with a very long passage that ends with the $k$&nbsp;doors one after another. You make the passage long enough that the optimal solution is definitely to collect all the keys first and then walk down that passage and unlock the doors, because walking back and forth between keys and doors would simply be too long. Now the hardness of the collect-all-the-items problem implies that your problem is hard, too.

If your maze is a tree, the problem might be easier&nbsp;&ndash; the collect-all-the-items version has a polynomial-time algorithm in that case.  And, in any case, the more general problem being NP-complete doesn't mean there aren't more efficient algorithms than brute force: but it does mean you shouldn't expect a polynomial-time algorithm.