As reported: Goldman Sachs Associate CoderPad round (2026): LeetCode 490 The Maze.
A ball sits in a maze of empty cells (0) and walls (1). It rolls up, down, left or right and keeps rolling until it hits a wall (or the border), then it may choose a new direction. Given start and destination, return true if the ball can stop at the destination.
This is LeetCode 490 — The Maze.
Example 1
maze = [[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]], start = [0,4], destination = [4,4]
-> true
Example 2
maze = [[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]], start = [0,4], destination = [3,2]
-> false
Example 3
maze = [[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]], start = [4,3], destination = [0,1]
-> false
Constraints: 1 ≤ m, n ≤ 100; start and destination are empty cells and differ.
Code runner format: one JSON value per line: maze, then start, then destination (LeetCode's test-case format). Implement hasPath(maze, start, destination); the harness prints the result as JSON.