Given an n x m integer matrix, find the shortest path from (0,0) to (n-1,m-1) such that the sum of values along the path is minimum, and the path is also lexicographically smallest among all the paths with minimum sum. You are allowed to move up, down, left, right. Print the path as a string of letters L (left), R (right), U (up), D (down).
1 <= n <= 1000, 1 <= m <= 1000
I presume this is a modification of Dijkstra but I do not know how to do it. Can anyone help?









