Thank you so much Mik ❤❤ Today I got placed . I can't explain in words I was waiting for this day from the last few months and today it happened all because of you. Following your videos changed me a lot I am now consistent and disciplined all because of you. I'm always thankful to god that I got your channel. Today I got an on campus offer and now onwards I will try to crack other companies also. THANK YOU SO MUCH☺
Bhaiya, I believe what you are doing and how you are inspiring the generation needs to be celebrated. I am not from a Circuital branch even though I am from one of the top NIT's of India. But because of your DSA teaching I have secured placement as Software Developer Engineer at one of the good company.❤❤
Your motivation has made me disciplined. I am consistent now, I work hard even though I fail many times. This attitude has come not easily but after a lot of effort. All thanks to you MIK. Thank you for everything. Hats off to your for selfless contribution to coding community.
class Solution { public: int m,n; int t[101][101]; int solve(vector&obstacleGrid,int i,int j){ if(i >= m || j >= n || obstacleGrid[i][j] == 1) return 0; if(i == m-1 && j == n-1) return 1; if(t[i][j] != -1) return t[i][j]; int right = solve(obstacleGrid,i,j+1); int left = solve(obstacleGrid,i+1,j); return t[i][j] = right + left; } int uniquePathsWithObstacles(vector& obstacleGrid) { m = obstacleGrid.size(); n = obstacleGrid[0].size(); memset(t,-1,sizeof(t)); return solve(obstacleGrid,0,0); } };
Space-optimized bottom-up version in C++: class Solution { public: int uniquePathsWithObstacles(vector& obstacleGrid) { int m = obstacleGrid.size(), n = obstacleGrid[0].size(); if (obstacleGrid[0][0] == 1 || obstacleGrid[m-1][n-1] == 1) return 0; vector dp(2, vector(n, 0)); dp[0][0] = 1; bool flag = false; for (int j=1; j
Bottom up bhi khud se --- class Solution { public int uniquePathsWithObstacles(int[][] arr) { int m = arr.length; //rows int n = arr[0].length; // col int t[][] = new int[m][n]; for(int i=0; i
From 2D based, i hope you mean Grid based dp right ? They are in this playlist only. Video links below : 1) Introduction Part- : ruclips.net/video/5LbcUNIy2mw/видео.htmlsi=2CZPVafr9soYe5DD 2) Introduction Part-2 : ruclips.net/video/-B8hWstTp20/видео.htmlsi=4ALTyWKXHRjd_Odm 3) Unique Paths - ruclips.net/video/QDVxAf_hqRQ/видео.htmlsi=Vj7I8zGYbU5Xjfc8 4) Unique Paths 2 - ruclips.net/video/9RUpue4oMx4/видео.htmlsi=k_5On-idjhUARLSP 1D based DP, string based DP are also in this same playlist
It depends on what movements are allowed. If the Robot is standing at top right corner and the movements allowed are only right and down, then it will never be able to reach bottom left.
public int uniquePathsWithObstacles(int[][]grid){ if(grid[0][0]==1) return 0; int m=grid.length,n=grid[0].length; int[][]dp=new int[m][n]; dp[m-1][n-1]=1; for(int i=m-1;i>=0;i--) for(int j=n-1;j>=0;j--){ if(i==m-1&&j==n-1) continue; int bottom; if(i+1
Thank you so much Mik ❤❤ Today I got placed . I can't explain in words I was waiting for this day from the last few months and today it happened all because of you. Following your videos changed me a lot I am now consistent and disciplined all because of you. I'm always thankful to god that I got your channel. Today I got an on campus offer and now onwards I will try to crack other companies also. THANK YOU SO MUCH☺
Wow. Many Many Congratulations 🎊🎊❤️❤️
So happy to hear this.
@@codestorywithMIK Thank You 😇
Bhaiya, I believe what you are doing and how you are inspiring the generation needs to be celebrated.
I am not from a Circuital branch even though I am from one of the top NIT's of India. But because of your DSA teaching I have secured placement as Software Developer Engineer at one of the good company.❤❤
Congrats bhai. Getting placed in software from non-critical branch is not easy. you did it. kudos.
Wow. Many Many Congratulations 🎊🎊❤️❤️
So happy to hear this.
Your motivation has made me disciplined. I am consistent now, I work hard even though I fail many times. This attitude has come not easily but after a lot of effort. All thanks to you MIK. Thank you for everything. Hats off to your for selfless contribution to coding community.
Bro please keep the dp series going, have an important interview coming up in a couple of weeks your explanations are too good
Samaj gaya problem, sir ❤❤
Thanks you so much I have a interview after some weeks.
I hope you finish this playlist as soon as possible ❤❤❤
Recursion and Recursion + Memoization khud se ho gaya bhai
i solved it on my on without seeing solution tq sir
class Solution {
public:
int m,n;
int t[101][101];
int solve(vector&obstacleGrid,int i,int j){
if(i >= m || j >= n || obstacleGrid[i][j] == 1) return 0;
if(i == m-1 && j == n-1) return 1;
if(t[i][j] != -1) return t[i][j];
int right = solve(obstacleGrid,i,j+1);
int left = solve(obstacleGrid,i+1,j);
return t[i][j] = right + left;
}
int uniquePathsWithObstacles(vector& obstacleGrid) {
m = obstacleGrid.size();
n = obstacleGrid[0].size();
memset(t,-1,sizeof(t));
return solve(obstacleGrid,0,0);
}
};
Thanks a lot ❤
Space-optimized bottom-up version in C++:
class Solution {
public:
int uniquePathsWithObstacles(vector& obstacleGrid) {
int m = obstacleGrid.size(), n = obstacleGrid[0].size();
if (obstacleGrid[0][0] == 1 || obstacleGrid[m-1][n-1] == 1)
return 0;
vector dp(2, vector(n, 0));
dp[0][0] = 1;
bool flag = false;
for (int j=1; j
Bottom up bhi khud se ---
class Solution {
public int uniquePathsWithObstacles(int[][] arr) {
int m = arr.length; //rows
int n = arr[0].length; // col
int t[][] = new int[m][n];
for(int i=0; i
Sir plz fast upload the next videos.....
Thankssss a lot.
Did you made vedios on 2d based dynamic programming??
Or it's not in this playlist?
From 2D based, i hope you mean Grid based dp right ?
They are in this playlist only. Video links below :
1) Introduction Part- : ruclips.net/video/5LbcUNIy2mw/видео.htmlsi=2CZPVafr9soYe5DD
2) Introduction Part-2 : ruclips.net/video/-B8hWstTp20/видео.htmlsi=4ALTyWKXHRjd_Odm
3) Unique Paths - ruclips.net/video/QDVxAf_hqRQ/видео.htmlsi=Vj7I8zGYbU5Xjfc8
4) Unique Paths 2 - ruclips.net/video/9RUpue4oMx4/видео.htmlsi=k_5On-idjhUARLSP
1D based DP, string based DP are also in this same playlist
public int uniquePathsWithObstacles(int[][]grid){
int m=grid.length,n=grid[0].length;
int[]dp=new int[n];
dp[0]=grid[0][0]==0?1:0;
for(int i=0;i
If the robot stands on the top right corner and want to reach bottom left.. thenn what will be its approach
It depends on what movements are allowed. If the Robot is standing at top right corner and the movements allowed are only right and down, then it will never be able to reach bottom left.
App SDE ka koi course q ni banate ?
Bhaiya 21 dec ke potd ka video abhi reh gya h
public int uniquePathsWithObstacles(int[][]grid){
if(grid[0][0]==1) return 0;
int m=grid.length,n=grid[0].length;
int[][]dp=new int[m][n];
dp[m-1][n-1]=1;
for(int i=m-1;i>=0;i--)
for(int j=n-1;j>=0;j--){
if(i==m-1&&j==n-1) continue;
int bottom;
if(i+1
recursion + memo:
class Solution {
int m, n;
vector dp;
public:
int helper(vector &grid, int i, int j) {
if(i == m-1 && j == n-1) return 1;
if(i == m || j == n || grid[i][j]) return 0;
if(dp[i][j] != -1) return dp[i][j];
return dp[i][j] = helper(grid, i+1, j) + helper(grid, i, j+1);
}
int uniquePathsWithObstacles(vector& obstacleGrid) {
m = obstacleGrid.size();
n = obstacleGrid[0].size();
if(obstacleGrid[m-1][n-1]) return 0;
dp.resize(m+1, vector(n+1, -1));
return helper(obstacleGrid, 0, 0);
}
};