Back to course home
0% completed
The Maze II (medium)
Problem Statement
There is a ball in a maze with empty spaces (0)
and walls (1)
. The ball can move up
, down
, left
, or right
through empty spaces but won't stop until it hits a wall. When the ball stops, it can change direction.
Given an m x n
maze, the ball's start
position, and the destination
, where start = [start<sub>row</sub>, start<sub>col</sub>] and destination = [destination<sub>row</sub>, destination<sub>col</sub>], find the shortest distance for the ball to reach the destination. If the ball can't reach the destination, return -1.
.....
.....
.....
Like the course? Get enrolled and start learning!
Table of Contents
Contents are not accessible
Contents are not accessible
Contents are not accessible
Contents are not accessible
Contents are not accessible