Get Maze Paths with Jump - Solution | Recursion | Data Structures and Algorithms in JAVA

แชร์
ฝัง
  • เผยแพร่เมื่อ 6 ม.ค. 2025

ความคิดเห็น • 87

  • @hymnish_you
    @hymnish_you 4 ปีที่แล้ว +44

    Sir, aap is era ke best teacher hain. Aapka birthday 21st century ka teachers day ke roop mein manana chahie.

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว +60

      Please help me reach out to more students. Maybe you can write abou this channel on linkedin or facebook.
      Can you post this?
      My mentor, Sumeet Malik from Pepcoding is making all his content freely available to the community
      You can check it out here - www.pepcoding.com/resources/
      Also, this is the youtube channel - th-cam.com/users/Pepcodingplaylists?view_as=subscriber
      Use it. This will be really beneficial.
      #programming #programmers #coding #codingisfun #codingislife #dsalgos #datastructures #algorithms
      #java #cpp #competitiveprogramming #interviewquestions #micrsoftinterview #amazoninterview
      #adobeinterview #goldmansachsinterview #leetcodequestions #codechefquestions #codeforcesquestions
      #freeprogrammingtutorials #freetutorials #freecodingcourses

    • @shubhamkhuntia2412
      @shubhamkhuntia2412 2 ปีที่แล้ว +1

      @@Pepcoding for sure

    • @mountaineverestofinformati2815
      @mountaineverestofinformati2815 2 ปีที่แล้ว +1

      @@Pepcoding even i did this

  • @santanudutta3809
    @santanudutta3809 3 ปีที่แล้ว +36

    My Brain to me: Recursion is very tough to digest.
    My Heart: Meditate on Sumeet Malik Sir.🙃🙃🙃🙃
    Hail to the genius...........Hail to the God of Programming.......

    • @Pepcoding
      @Pepcoding  3 ปีที่แล้ว +32

      Always with you beta padhte rahe kabhi haar nahi manni h mehnat ke aage sab aasaan hai

    • @abhishekranjan1094
      @abhishekranjan1094 3 ปีที่แล้ว +1

      Right 😉

  • @neha6000
    @neha6000 2 ปีที่แล้ว

    Not only I learn recursion very well par meri hindi aur bhi achhi ho gayi 👍👍👍

  • @raj_kundalia
    @raj_kundalia 3 ปีที่แล้ว +2

    Watched on 25 October, 2021 - Thank you very much for the video.

  • @redline_ghatak
    @redline_ghatak 2 ปีที่แล้ว

    sir I am totally impressed with your logic making skills, I really want to make logics like you..very easily and simple..

  • @kishankanabar6620
    @kishankanabar6620 3 ปีที่แล้ว

    You are great sir. I was just thinking why cant we implement previous code this way!! and here it is!!.

  • @kishanpareek2848
    @kishanpareek2848 2 ปีที่แล้ว +1

    I Feel that Pepcoding Should apply for Guiness World Record for "Most Number Of Coding Question's Solution On TH-cam" .

  • @arunadang2130
    @arunadang2130 2 ปีที่แล้ว +1

    Nice explanation
    Feedback - it would be good if variable names are proper. It will increase user readability and ease to understand.

  • @sanskarsharma6440
    @sanskarsharma6440 3 ปีที่แล้ว +6

    please help .
    sir i've written my code in cpp my output is wrong and test cases failed and your website also does not have the solution.
    please help.

  • @aashishgoyal1436
    @aashishgoyal1436 4 ปีที่แล้ว +1

    Thank u sir. ur each video tutorial is a gold

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว

      Thanks and welcome

  • @omkarnaththakur5691
    @omkarnaththakur5691 3 ปีที่แล้ว +4

    Sir your singing , and choice of songs are also great though !!

    • @Pepcoding
      @Pepcoding  3 ปีที่แล้ว +1

      I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem.
      If you like our efforts, we request a review
      g.page/Pepcoding/review?rc
      You can subscribe to our channel here
      th-cam.com/users/Pepcodingabout?view_as=subscriber

    • @035asadali8
      @035asadali8 2 ปีที่แล้ว

      @@Pepcoding bot 🤣

  • @abhimanyurathore8765
    @abhimanyurathore8765 4 ปีที่แล้ว +3

    Sir you are doing great job....

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว +2

      Keep watching. Also, share and subscribe.

  • @Nikhil-qd9up
    @Nikhil-qd9up 3 ปีที่แล้ว

    Sir ur approach is great 💯

  • @LegitGamer2345
    @LegitGamer2345 4 ปีที่แล้ว +5

    no need to check for >dr || >dc in base case since loop is running till

  • @hemantsingh-zo3iw
    @hemantsingh-zo3iw 4 ปีที่แล้ว +2

    Awesome explanation!!

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว +2

      Glad you think so!

  • @rohanjaiswal64
    @rohanjaiswal64 4 ปีที่แล้ว

    amazing way of teaching , loved it @sumit sir.

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว +2

      I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem.
      If you like our efforts, we request a review - g.page/Pepcoding/review?rc

    • @divyanshuyadav5524
      @divyanshuyadav5524 3 ปีที่แล้ว

      @@Pepcoding done ✅

  • @ashishgoswami6303
    @ashishgoswami6303 4 ปีที่แล้ว +6

    Thanx for this video sir but wouldn't move size increase for a matrix bigger than 4x4, so we would be having bigger jumps than 3.
    Example - for a 5x5 matrix we would be jumpig 5 steps at a time at the last loop when we're at the first index as move size

    • @ashishgoswami6303
      @ashishgoswami6303 4 ปีที่แล้ว +15

      Oh my bad sir, I watched the question and presumed we could only jump at max 3 a time. Looking at it again. I understood we're allowed maximum jumps of length maxtrix. Just gonna leave this comment here incase anyone has this doubt.
      Great content sir, I'm sure as soon as CS students find this it's gonna reach millions.

    • @amritatiwary.
      @amritatiwary. 7 หลายเดือนก่อน

      ​@@ashishgoswami6303 your doubt and your explanation about doubt really helped me , I solved this question by thinking max jump is 3 , I read the question again , but It was not clear about max jump , thanku , your comment helped me

  • @chiraggill2940
    @chiraggill2940 ปีที่แล้ว

    why didn't we check here for the conditon that horizontal moves should be within the maze if we take mutiple steps horizontally of varied lengths ,we could loose the track.i.e we should have used condition to eliminate such cases.

  • @anuragkumargupta7506
    @anuragkumargupta7506 5 หลายเดือนก่อน

    Hello Sir ,Nowadays, prepcodding website is not working ,seems its down from many months, the resources are also not availble to use .
    is there alternet website you have created ?

  • @Rajyadav-ll3dk
    @Rajyadav-ll3dk ปีที่แล้ว

    Sir you can't directly add ms with characters as it is an Integer . So first of all we have to convert ms into string.

  • @kapishsingh
    @kapishsingh 3 ปีที่แล้ว

    for line no 43 it worked for me *d

  • @bambu-mq9zg
    @bambu-mq9zg 2 ปีที่แล้ว

    Sir pepcoding ke compiler me ek fault hai wo apke bataye gaye method se hi shi kaam kr raha hai mtlb output ka order agr change ho raha hai to wrong answer bata raha hai

  • @samirray7544
    @samirray7544 4 ปีที่แล้ว +1

    great sir

  • @SCRIPTSAG
    @SCRIPTSAG 4 ปีที่แล้ว +1

    Sir basicly apne loop wo kitna bat maximum jump ker sakte hai esliye lagya hai na nhi to normal 8 function likh ker ker sakte the age
    Input 4*4 ke liye

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว

      yes. par loop to 5 * 5 aur 6 * 6 ke liye bhi chalega 8 calls to 4 * 4 ke liye he chalega

  • @sakshiaggarwal6199
    @sakshiaggarwal6199 3 ปีที่แล้ว

    Thank you so much sir!!

    • @Pepcoding
      @Pepcoding  3 ปีที่แล้ว

      Thankyou beta!
      I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem.
      If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

  • @FirstLearningthanEarning
    @FirstLearningthanEarning 4 ปีที่แล้ว +1

    sir jump can be for( int jump=1;jump+sc

  • @navinchainani4721
    @navinchainani4721 2 ปีที่แล้ว

    Why we done dc-sc and dr-sr

  • @deeksha6514
    @deeksha6514 3 ปีที่แล้ว

    Sir you are making a new arrraylist in recursive function so wo har bar new banti jayegi so aise to bahut ans aayenge.Get MazePath mein aisa nahi kiya tha

  • @jatinbhatoya8420
    @jatinbhatoya8420 4 ปีที่แล้ว +1

    iss question ko krne se zayada mza iska output dekhne main hai. it will be huge. mera vs code hi crash maar gya 5 *5 matrix ke liye

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว

      If you like our efforts, will you like to review us here - g.page/Pepcoding/review?rc
      Keep learning and keep loving Pepcoding😊

  • @yayyshivani
    @yayyshivani ปีที่แล้ว

    🙌

  • @SCRIPTSAG
    @SCRIPTSAG 4 ปีที่แล้ว +1

    Sir esme apne array ki jo new list bnayi hai wo her bar new bnenti jayega to ek hi paths nhi hoga wo to bahut sare path ben jayenge

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว +2

      in java there shallow copy is there and our expectation is in this question is it will return us an arraylist of paths in which we will be having no of paths from that intermidate to destination and after then if i as a src decide then i have to include myself in those paths

  • @anuragkumargupta7506
    @anuragkumargupta7506 5 หลายเดือนก่อน

    sorry sir ,
    but above code have some minute mistake.
    import java.util.*;
    public class Main
    {
    public static void main (String[] args) throws java.lang.Exception
    {
    Scanner src = new Scanner(System.in);
    int n = src.nextInt();
    int m=src.nextInt();
    ArrayList paths = printAllMazePathwdJumps(1,1,n,m);
    System.out.println(paths);
    }
    public static ArrayList printAllMazePathwdJumps(int sr ,int sc,int dr,int dc)
    {
    if( sr ==dr &&sc==dc)
    {
    ArrayList bapath = new ArrayList();
    bapath.add("");
    return bapath;
    }
    ArrayList mypaths = new ArrayList();
    //horizental jumps
    for(int ms =1;ms+sc

  • @rahulrana8912
    @rahulrana8912 3 ปีที่แล้ว

    Sir ismei wo check kyun nahi lagaya jo batata hai ki kab sirf horizontal move possible jab aap final column se peeche ho and vertical move is possible jab aap bottom row se peeche ho ?
    jaise pichle getMazePaths walei question mei lagaya tha.

    • @abhishekanand5898
      @abhishekanand5898 3 ปีที่แล้ว

      Wo for loop ki condition se check ho ja rahi bhaii...ki apan deewar pel ke bahar na ja sake..

    • @rahulrana8912
      @rahulrana8912 3 ปีที่แล้ว

      @@abhishekanand5898 par bhai wo for loop toh sirf ye decide krne ke liye hai ki hum kitna bada jump marenge

    • @abhishekanand5898
      @abhishekanand5898 3 ปีที่แล้ว

      @@rahulrana8912 jump aur constriant dono decide ho rhi bhai...ek bar 3*3 pe dry run smjh aajyega

    • @rahulrana8912
      @rahulrana8912 3 ปีที่แล้ว +1

      @@abhishekanand5898 hn thanks brother👍

  • @dheerajyadav9099
    @dheerajyadav9099 4 ปีที่แล้ว +1

    Sir remaning topic kab tak upload honge??

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว

      Beta, jaldi he resume krege content upload krna.

    • @utkarshsharma6650
      @utkarshsharma6650 3 ปีที่แล้ว +1

      2022

  • @princekumar7042
    @princekumar7042 3 ปีที่แล้ว +1

    sir please start interviewBit question of top comapnies

    • @Pepcoding
      @Pepcoding  3 ปีที่แล้ว +1

      Beta, level-2 main check kro bits k thore questions daale h

    • @princekumar7042
      @princekumar7042 3 ปีที่แล้ว

      There is no videos on trees

  • @orion2843
    @orion2843 3 ปีที่แล้ว +2

    Did anyone tried this code in C++?
    I don't know why but my program is crashing in VsCode as well as in Sublime Text.
    Btw Thanks a Lot from Depth of My Heart Sumeet Sir.@PepCoding❤️

    • @divyanshuyadav5524
      @divyanshuyadav5524 3 ปีที่แล้ว

      Send me yr code

    • @divyanshuyadav5524
      @divyanshuyadav5524 3 ปีที่แล้ว

      I had a issue but now it is running on my vs

    • @aniketghosh2001
      @aniketghosh2001 3 ปีที่แล้ว

      @@divyanshuyadav5524 Bhai can u plz send your c++ code

    • @divyanshuyadav5524
      @divyanshuyadav5524 3 ปีที่แล้ว

      @@aniketghosh2001 let me try...cauz it is quite difficult for me to send the code here 😔

    • @tanyachhabra5537
      @tanyachhabra5537 3 ปีที่แล้ว

      even I am unable to code this in c++. Kindly help if you have figured out the solution

  • @amritanshvajpayee5147
    @amritanshvajpayee5147 4 ปีที่แล้ว +3

    Sir:
    Actual output:
    [h1h1v1, h1v1h1, h1d1, h2v1, v1h1h1, v1h2, d1h1]
    Expected output:
    [h1h1v1, h1v1h1, h1d1, v1h1h1, v1h2, d1h1, h2v1]
    I am getting WA, just because my sequence of paths is different compared to expected output. Please help

  • @princekumar7042
    @princekumar7042 3 ปีที่แล้ว

    sir there is no video on trees

    • @Pepcoding
      @Pepcoding  3 ปีที่แล้ว +2

      Beta, dhng se website ya channel explore kro, jispr bhi dekh rhe ho aap videos. Here's is the link of some questions on GT- www.pepcoding.com/resources/online-java-foundation/generic-tree

  • @rajatverma6584
    @rajatverma6584 2 ปีที่แล้ว

    public class MazePathJump {
    // move is horizontal or vertical
    private static void mazesolve(int i, int j, int n,int [][] maze,int [][] path) {
    if(i=n || maze[i][j]==0 || path[i][j]==1 )
    return;

    path[i][j]=1;
    if(i==n-1 && j==n-1){
    for(int r=0;r