The Maze

Medium · Queue & Deque · about 20 minutes

Asked at Google, Uber, Snap, Snowflake, Amazon, Discord.

In a grid maze (0 = open, 1 = wall, with walls all around the border), a ball can be pushed up, down, left or right. Once pushed, it keeps rolling until a wall stops it, and only then can it be pushed again. Decide whether the ball, starting at start, can come to rest exactly on destination (rolling over it doesn't count).

Related guides