|
|
back to boardApproach Posted by karan 28 Aug 2013 17:59 I used dijkstra to do in O(mnlog(mn))? Whats your approach? I used dp I used dynamic programming to solve the question. dp[floor][room][lastStep] indicates the best way to reach top when we are on floor, room and the last step is know. Each state of dp is solved in constant time as we have to do only 2 computations at each step. But my approach runs very very slow. Re: I used dp Two dimensions are enough Re: Approach DP can solve this problem in O(MN). |
|
|