You know Dijkstra. You know BFS. But the interview problem has a twist: you can remove walls, or edges cost or , or you need the shortest path that visits specific nodes in order.
So, what do you do?
The idea is state expansion. Instead of , you track where the extra state tracks whatever constraint matters. I'll show you how to recognize these variants and modify your state space.
The algorithm stays the same. We just expand it with additional dimensions.