Unique Paths II | Recursion | Memo | Bottom Up | Leetcode 63 | DP On Grids | codestorywithMIK

Поделиться
HTML-код
  • Опубликовано: 4 янв 2025

Комментарии •

  • @laxmisingh8323
    @laxmisingh8323 10 дней назад +4

    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☺

    • @codestorywithMIK
      @codestorywithMIK  9 дней назад

      Wow. Many Many Congratulations 🎊🎊❤️❤️
      So happy to hear this.

    • @laxmisingh8323
      @laxmisingh8323 9 дней назад +1

      @@codestorywithMIK Thank You 😇

  • @jeehub041
    @jeehub041 10 дней назад +7

    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.❤❤

    • @gui-codes
      @gui-codes 10 дней назад

      Congrats bhai. Getting placed in software from non-critical branch is not easy. you did it. kudos.

    • @codestorywithMIK
      @codestorywithMIK  9 дней назад

      Wow. Many Many Congratulations 🎊🎊❤️❤️
      So happy to hear this.

  • @gui-codes
    @gui-codes 10 дней назад +2

    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.

  • @Muigoku49
    @Muigoku49 10 дней назад +5

    Bro please keep the dp series going, have an important interview coming up in a couple of weeks your explanations are too good

  • @sarangkale6761
    @sarangkale6761 9 дней назад +1

    Samaj gaya problem, sir ❤❤

  • @Believe_yourself-eo1ho
    @Believe_yourself-eo1ho 9 дней назад +1

    Thanks you so much I have a interview after some weeks.
    I hope you finish this playlist as soon as possible ❤❤❤

  • @nimishgupta5289
    @nimishgupta5289 5 часов назад +1

    Recursion and Recursion + Memoization khud se ho gaya bhai

  • @TEJASSURYA-r2v
    @TEJASSURYA-r2v 2 дня назад +1

    i solved it on my on without seeing solution tq sir

    • @TEJASSURYA-r2v
      @TEJASSURYA-r2v 2 дня назад +1

      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);
      }
      };

  • @aws_handles
    @aws_handles 9 дней назад

    Thanks a lot ❤

  • @prateekbhaisora
    @prateekbhaisora 5 дней назад +1

    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

  • @nimishgupta5289
    @nimishgupta5289 5 часов назад +1

    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

  • @piashbiswas
    @piashbiswas 9 дней назад

    Sir plz fast upload the next videos.....
    Thankssss a lot.

  • @Zoro_tao
    @Zoro_tao 7 дней назад +1

    Did you made vedios on 2d based dynamic programming??
    Or it's not in this playlist?

    • @codestorywithMIK
      @codestorywithMIK  7 дней назад +1

      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

  • @dayashankarlakhotia4943
    @dayashankarlakhotia4943 10 дней назад +1

    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

  • @FindWordGame
    @FindWordGame 9 дней назад

    If the robot stands on the top right corner and want to reach bottom left.. thenn what will be its approach

    • @gui-codes
      @gui-codes 9 дней назад

      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.

  • @Up_wale_reviewer
    @Up_wale_reviewer 10 дней назад

    App SDE ka koi course q ni banate ?

  • @itsharshita22
    @itsharshita22 10 дней назад

    Bhaiya 21 dec ke potd ka video abhi reh gya h

  • @dayashankarlakhotia4943
    @dayashankarlakhotia4943 9 дней назад

    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

  • @masterLight313
    @masterLight313 10 дней назад +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);
    }
    };