Back to Browse

Rat – Maze Problem | Backtracking | Print Rat Path

16.3K views
May 9, 2020
18:00

Source Code:https://thecodingsimplified.com/rat-maze-problem/ Solution: - We'll solve it using DFS approach - We'll take a solution matrix - Rat moves down then right side - If there's safe path, we mark value as 1 in Solution matrix - If there's no path from a index, we need to backtrack, so we reset the value to 0 for that index - At the last if rat reaches to x = N - 1 & y = N-1, it means we've a solution - Now we've all path in solution matrix Time Complexity: O(N * N) Space Complexity: O(N * N) CHECK OUT CODING SIMPLIFIED https://www.youtube.com/codingsimplified ★☆★ VIEW THE BLOG POST: ★☆★ http://thecodingsimplified.com I started my YouTube channel, Coding Simplified, during Dec of 2015. Since then, I've published over 400+ videos. ★☆★ SUBSCRIBE TO ME ON YOUTUBE: ★☆★ https://www.youtube.com/codingsimplified?sub_confirmation=1 ★☆★ Send us mail at: ★☆★ Email: [email protected]

Download

1 formats

Video Formats

360pmp423.2 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

Rat – Maze Problem | Backtracking | Print Rat Path | NatokHD