I'm sure there is some way to speed up the search :)

I tried checking if the destination exists on the path while the ball is rolling before it hits the wall, if the destination doesn't have any wall around, then it's definitely not able to stop there. But it didn't speed up the runtime :(

Look forward to some smart optimized solutions!

```
public class Solution {
public boolean hasPath(int[][] maze, int[] start, int[] destination) {
int m = maze.length, n = maze[0].length;
boolean[][] visited = new boolean[m][n];
int[] dx = new int[]{0, -1, 0, 1};
int[] dy = new int[]{1, 0, -1, 0};
Queue<int[]> queue = new LinkedList<>();
queue.offer(start);
visited[start[0]][start[1]] = true;
while (!queue.isEmpty()) {
int[] curPos = queue.poll();
if (curPos[0] == destination[0] && curPos[1] == destination[1]) {
return true;
}
// try four direction until it hits the wall
for (int direction = 0; direction < 4; direction++) {
int nx = curPos[0], ny = curPos[1];
while (nx >= 0 && nx < m && ny >= 0 && ny < n && maze[nx][ny] == 0) {
nx += dx[direction];
ny += dy[direction];
}
//back one step
nx -= dx[direction];
ny -= dy[direction];
if (!visited[nx][ny]) {
visited[nx][ny] = true;
queue.offer(new int[]{nx, ny});
}
}
}
return false;
}
}
```