Open In App

Tutorial on Path Problems in a Grid, Maze, or Matrix

Path in a Grid or Maze refers to problems that involve navigating through a grid-like structure from the source (starting point) to the destination (endpoint) while avoiding the obstacles i.e., following rules and constraints.

Path in a Maze/Grid

Grid and Maze Representation:

A grid or a maze is generally represented as a 2D array or matrix consisting of rows and columns. Each cell is a intersection of a particular row and column and it represents a location in the grid. The cells in the grid may be open for traversal or may be blocked by an obstacle. If a cell is blocked by an obstacle that cell cannot be visited.

Common Pathfinding Problems:

Common Algorithms in Pathfinding Problems:

Pathfinding problems often require the use of various algorithms like:-

Given below are the most common Grid/Maze problems:

Problems

Links

Rat in a Maze

Link

Rat in a Maze Problem when movement in all possible directions is allowed

Link

Rat in a Maze with multiple steps or jump allowed

Link

Unique paths in a Grid with Obstacles

Link

Count number of ways to reach destination in a Maze

Link

Minimum distance to the end of a grid from source

Link

Shortest path in a Binary Maze

Link

Find paths from corner cell to middle cell in maze

Link

Geek in a Maze

Link

Minimum moves required to come out of a grid safely

Link

Minimum Initial Points to Reach Destination

Link

Moving on grid

Link

Minimum cost to cover the given positions in a N*M grid

Link

Collect maximum points in a grid using two traversals

Link

Number of ways to go from one point to another in a grid

Link

Maximum Score by travelling from (1, 1) to (N, N) on grid

Link


Article Tags :