Unique Paths II | Made Super Easy | Recursion | Memoization | 2D Array | AMAZON | Leetcode-63

preview_player
Показать описание
This is the 57th Video on our Dynamic Programming (DP) Playlist.
In this video we will try to solve a very famous DP Problem - Unique Paths II (Leetcode-63).

Trust me, this will no longer be a Medium Problem.
I will explain the intuition so easily that you will never forget and start seeing this as cakewalk EASYYY.
We will do live coding after explanation and see if we are able to pass all the test cases.

Problem Name : Unique Paths II
Company Tags : Amazon, Cisco, Paytm, OLA Cabs, Walmart, LinkedIn

╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝

Introduction and Problem understanding - 00:00
Intuition Building + Dry Run - 3:19
Story to code : 5:55
Few Important Points - 8:14
Time Complexity - 12:02
Why Memoization will work - 13:26
Live Coding Cpp - 15:30
Java Code : 18:56

#coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge#leetcodequestions #leetcodechallenge #hindi #india #hindiexplanation #hindiexplained #easyexplaination #interview#interviewtips #interviewpreparation #interview_ds_algo #hinglish #github #design #data #google #video #instagram #facebook
Рекомендации по теме
Комментарии
Автор

In almost 2 weeks now im able to solve these recursive dp questions on my own because of you. Consistency and good explanation is the key❤

headburstergaming
Автор

Why this channel was hidden from coders ...
Thanks sir . next level explanation

avishkargaikwad
Автор

I feel like magic has happened that I am able to solve such type of questions without watching your video or solution.
Never thought it would be possible but you made it possible.
Thank you so much 😇⭐

bhartipatel
Автор

India needs many more teachers like you.. Please never ever stop making these videos !!!!

qRpKsJt
Автор

I solved it myself your explanation are always best 👌🏻

anuppatankar
Автор

FEW IMPORTANT POINTS SECTION WAS SUPER USEFUL, I HAD ONLY ONE DOUBT THAT DO WE NEED TO MAINTAIN VISITED OR NOT AND YOU ADDRESSED THAT THANK YOU SO MUCH 🤩

kunal
Автор

I think that solving matrix problems are the easiest DP question. waiting for a recursive question with for-loop.

souvikmukherjee
Автор

Bro what do you eat? Do you eat something special to make your explanation so smooth?

thegreekgoat
Автор

thank u so so much for making this question super easy❤

the minute details which u give during your explanations make your videos much more worth

oqant
Автор

Thanks bhai, i solved it when your video in 5:00 minute. Thanks bhai, your are boss. Solute you.

JoyAcharyatvl
Автор

Sir it would be helpful if you add bottom up approach also in solving dp questions.

kashifrahman
Автор

I solved this on my own [although I missed one edge case, where obstacleGrid[m - 1][n - 1] is 1], but all credit goes you bro.
But still there are a ton of problem that makes me think twice, that weather I could solve these problems in a real interview !!😓

itspravas
Автор

dope explanation as always. Always get to learn a lot from your videos.

wearevacationuncoverers
Автор

Absolutely great explanation...i will love to see more videos on trees, graphs and dp tricky pattern questions 🙏🙏🙏🙏

sauravbiswajit
Автор

thanks for the video. this was easy 😀 i was able to solve it myself.

floatingpoint
Автор

How do you do this. You make things extremely easy. After watching your explanation, I am always able to code it up on my own.

AlishaKhan-wwio
Автор

Java Tabulation code:

class Solution {
public int grid) {
int n = grid.length;
int m = grid[0].length;

int[][] dp = new int[n][m];

if(grid[0][0]==0) dp[0][0] =1;

for(int down=0; down<n; down++){
for(int right=0; right<m; right++){
if(down == 0 && right==0) continue;
else{
if(grid[down][right]!=1){
int downwards = 0, rightwards = 0;

if(down>0)
downwards = dp[down-1][right];
if(right>0)
rightwards = dp[down][right-1];

dp[down][right] = (downwards+rightwards);

}
}

}
}

return dp[n-1][m-1];

}
}

RahulGuptaa
Автор

Bhaiya I am having trouble in solving the question shortest cycle in graph(undirected) .Can u please upload a video soln for this.Since your explanations are so good, i thought it would be really good to reach out to you . Although thanks a lot for your videos, because of u now i am able to solve most of the dp and graph questions💌💌

priyadarshanghoshhazra
Автор

Equivalent tabulated code in C++:

class Solution {
public:
bool isValid(int i, int j, int n, int m) {
return i >= 0 && j >= 0 && i < n && j < m;
}
int arr) {
int n = arr.size(), m = arr[0].size();
if (arr[0][0] == 1 || arr[n-1][m-1] == 1) return 0;
vector<vector<int>> dp(n, vector<int>(m, 0));
dp[0][0] = 1;
for (int i=0; i<n; i++) {
for (int j=0; j<m; j++) {
if (i == 0 && j == 0) continue;

if (isValid(i, j-1, n, m) && arr[i][j] != 1)
dp[i][j] += dp[i][j-1];

if (isValid(i-1, j, n, m) && arr[i][j] != 1)
dp[i][j] += dp[i-1][j];
}
}
return dp[n-1][m-1];
} // TC = O(n.m) SC = O(n.m)
};

prateekbhaisora
Автор

you are great sir, thank you for java code

VIJAYYADAVPCECR
welcome to shbcf.ru