Make your first Pull Request for Hacktoberfest 2024! Don’t forget to spread the love, and if you find it helpful, consider giving us a ⭐️. This repository includes useful algorithms and code to help beginners, featuring multiple languages and ideas. You’ll also find some beginner-friendly mini projects to get you started!
40
stars
295
forks
source link
Proposal : Adding an implementation of the Rat in a Maze Problem in C++. #223
Consider a rat placed at (0, 0) in a square matrix of order N * N. It has to reach the destination at (N - 1, N - 1). Find all possible paths that the rat can take to reach from source to destination. The directions in which the rat can move are 'U'(up), 'D'(down), 'L' (left), 'R' (right). Value 0 at a cell in the matrix represents that it is blocked and the rat cannot move to it while value 1 at a cell in the matrix represents that rat can travel through it.
What I’d Like to Do:
Implement the algorithm to find all possible paths for the rat to traverse from the start point to the destination in a maze represented as a 2D grid.
Provide a method to display the paths taken by the rat.
Write test cases to verify the implementation and ensure all edge cases are covered.
Consider a rat placed at (0, 0) in a square matrix of order N * N. It has to reach the destination at (N - 1, N - 1). Find all possible paths that the rat can take to reach from source to destination. The directions in which the rat can move are 'U'(up), 'D'(down), 'L' (left), 'R' (right). Value 0 at a cell in the matrix represents that it is blocked and the rat cannot move to it while value 1 at a cell in the matrix represents that rat can travel through it.
What I’d Like to Do: