499. The Maze III

There is a ball in a maze with empty spaces (0), walls (1), and a hole (2). The ball can roll through empty spaces until it hits a wall, then it stops. Find the lexicographically smallest path (using instructions 'l', 'r', 'u', 'd') for the ball to reach the hole.

Examples
Input: [[[0,0,0,0,0],[1,1,0,0,1],[0,0,0,0,0],[0,1,0,0,1],[0,1,0,0,0]],[4,3],[0,1]]
Output: "lul"
Hints
Related Problems

499. The Maze III

There is a ball in a maze with empty spaces (0), walls (1), and a hole (2). The ball can roll through empty spaces until it hits a wall, then it stops. Find the lexicographically smallest path (using instructions 'l', 'r', 'u', 'd') for the ball to reach the hole.