505. The Maze II

There is a ball in a maze with empty spaces (0) and walls (1). The ball can roll through empty spaces until it hits a wall, then it stops. Find the shortest distance (number of steps taken) for the ball to reach the destination and stop there.

Examples
Input: [[[0,0,1,0,0],[0,0,0,0,0],[0,0,0,1,0],[1,1,0,1,1],[0,0,0,0,0]],[0,4],[4,4]]
Output: 12
Hints
Related Problems

505. The Maze II

There is a ball in a maze with empty spaces (0) and walls (1). The ball can roll through empty spaces until it hits a wall, then it stops. Find the shortest distance (number of steps taken) for the ball to reach the destination and stop there.