Rat Maze With Multiple Jumps | Backtracking | GeeksforGeeks Problem of the Day

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

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

  • @probabilitycodingisfunis1
    @probabilitycodingisfunis1  2 года назад +5

    Problem: practice.geeksforgeeks.org/problems/rat-maze-with-multiple-jumps3852/1#
    Solution Code in CPP:
    vector ShortestDistance(vector&matrix){
    // Code here
    vectorans(matrix.size(),vector(matrix[0].size(),0));
    if(!ratmaze(matrix,ans,0,0))
    return {{-1}};
    return ans;
    }
    bool withinboundary(int i,int j,vector&matrix)
    {
    if(i>=matrix.size() || j>=matrix[0].size() || matrix[i][j]==0)
    return false;
    return true;
    }
    bool ratmaze(vector&matrix,vector&ans,int i,int j)
    {
    if(i==matrix.size()-1 && j==matrix[0].size()-1)
    { ans[i][j]=1;
    return true;
    }
    if(withinboundary(i,j,matrix))
    { ans[i][j]=1;
    for(int noofsteps=1;noofsteps

  • @sagayaraj6298
    @sagayaraj6298 5 месяцев назад

    but currently, GFG is asking us to do it in space complexity of O(1). 😥

  • @pratyushpandey6139
    @pratyushpandey6139 2 года назад +2

    29. Divide Two Integers leetcode daily problem is hard to get it conceptually , pls make this one !

  • @ankitjha7132
    @ankitjha7132 2 года назад +1

    you are making medium problem easy

  • @sanatanihindu9255
    @sanatanihindu9255 Год назад +1

    Very Very helpful

  • @Meanlifestudies2
    @Meanlifestudies2 2 года назад +1

    Thank you for logic and if you were also good in python please do programming in python aswell.

  • @pawanjumani99
    @pawanjumani99 2 года назад

    thanks , it was helpful

  • @shwetanksingh5438
    @shwetanksingh5438 2 года назад

    TC - O(R*C)?

  • @CodingwithATYoutuber
    @CodingwithATYoutuber 2 года назад

    Which playlist these questions are belong. I want to follow one playlist and complete that so l didn't find the upload questions playlist

  • @Mannu_20
    @Mannu_20 12 дней назад

    please tell me what's the issue in this code.
    it did not run ..????????
    class Solution {
    public:
    bool solve(int i, int j, int n, int m, vector& matrix, vector& vis) {
    if (i == n - 1 && j == m - 1) {
    vis[i][j] = 1;
    return true;
    }

    if (i < 0 || j < 0 || i >= n || j >= m || vis[i][j] == 1 || matrix[i][j] == 0) {
    return false;
    }

    vis[i][j] = 1;
    int jumps = matrix[i][j];

    for (int k = 1; k

  • @Rajat_maurya
    @Rajat_maurya 2 года назад

    thank you