Backtracking Introduction + Maze Problems - Theory + Code + Tips

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

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

  • @KunalKushwaha
    @KunalKushwaha  2 месяца назад +4

    DSA + interview preparation playlist: ruclips.net/p/PL9gnSGHSqcnr_DxHsP7AW9ftq0AtAyYqJ

    • @komalchauhan7535
      @komalchauhan7535 Месяц назад

      Kunal Please complete this playlist

    • @hforhonour
      @hforhonour Месяц назад

      Hi Kunal, desperately waiting for your DP playlist.

    • @sreeharsha9010
      @sreeharsha9010 Месяц назад

      Eagerly waiting for the OP-DP playlist Kunal! loved this tons❤

  • @kalpeshmali1476
    @kalpeshmali1476 2 года назад +110

    finally a teacher who understand that this topics are important to cover in depth and u have done this job 🔥🔥🔥🔥🔥

  • @rohitchilhorkar8114
    @rohitchilhorkar8114 2 года назад +163

    I watched all the videos of this playlist from the beginning and I must say you just made this complicated topics so easy to understand.
    Processed and Unprocessed String pattern is just awesome and has plenty of application's with slight variations. This video and the video before this was a cake walk for me, since I understood all the concepts very well. Thank you for making such an amazing playlist, you're really an amazing teacher. Kudos!

    • @KunalKushwaha
      @KunalKushwaha  2 года назад +19

      Glad it was helpful!

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

      @@KunalKushwaha yes just love the playlist by far the best OOP playlist ....just do complete the rest of the playlist...waiting for DPs and Hashmaps.

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

      @@KunalKushwaha hey...pls finish this playlist before starting new ones! These videos are amazing and it must nit be discontinued.

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

      I too feel the same

    • @Abcd-qp8gi
      @Abcd-qp8gi Год назад

      ​@@KunalKushwahaHello sir can you help me in a program . I'm struggling. can you send your email I'd...

  • @ankit_1012
    @ankit_1012 2 года назад +44

    Forget about content or the way of teaching others can't match even in terms of length of any single video of this dsa playlist.. 😁😁😁
    There's a reason why the Community is so much excited about this dsa course
    Btw now it's getting hard to match kunal's speed of uploading videos with my learning & practice speed 😅😅😅

    • @KunalKushwaha
      @KunalKushwaha  2 года назад +15

      Thanks! Do it at your own pace.

    • @felixboachieyiadom4457
      @felixboachieyiadom4457 Год назад +4

      @@KunalKushwaha please do dp I'm struggling a bit with it

    • @apnikakshya
      @apnikakshya 2 месяца назад +1

      SIR WHEN COVER REMAINING TOPICS​@@KunalKushwaha

  • @deeppanchal5102
    @deeppanchal5102 2 месяца назад +3

    Fun Fact : DP was never made in future till this vidoe after 2 years though ..............................

  • @shaunvarghese3400
    @shaunvarghese3400 2 года назад +32

    This is the first time i am learning backtracking....and i am glad i bumped into THIS video....very well explained....thanks Kunal...👌🙌

  • @sircillavenkatesh1458
    @sircillavenkatesh1458 7 месяцев назад +2

    Fun Fact: After this course DSA is all about copy paste🤣. Nothing is hard😎

  • @AkashDas-ze2co
    @AkashDas-ze2co 2 месяца назад +1

    In video also we are learning recursion...like some doubt arises go to the previous videos and again in the previous videos doubt arises go to the another previous video.....at the end if we will reach the base condition which we will have all answers and then we will return to this video with all doubts cleared. 😂😂
    BTW great effort and way of explaining the problems is really appreciable...hats of to you sir🙏🙏 ❤❤

  • @vikaskumarnitrr
    @vikaskumarnitrr 2 года назад +6

    if you have to fall in love with physics __ Walter Lewin.
    if you have to fall in love with coding ___ Kunal Bhaiya.

  • @kanakkanak1520
    @kanakkanak1520 2 года назад +12

    Thank you for making the recursion concept so easy😊 also, for breaking the myth 21:52, I believed in it for the longest time

  • @aakashmalhotra3157
    @aakashmalhotra3157 2 года назад +4

    Even a cpp student also watching these videos because such awesome content is not available for cpp.

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

    bro WTF why is this playlist put to halt.
    This playlist is legit knowldge provider.
    it should continue.
    placements are near.

  • @subham54321
    @subham54321 2 года назад +4

    Hi Kunal, your course is THE BEST. please release the video of OOP, when can we expect the OOP video?

  • @dipalitusharvlogs7252
    @dipalitusharvlogs7252 Год назад +5

    There is no doubt about Kunal's teaching skills, The way he looks at camera, feels like he is Infront of me and teaching 💚

  • @de-codr8814
    @de-codr8814 2 года назад +7

    best explanation available on youtube, literally the concept got imprinted in my mind, Kunal is too OP.

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

    Please sir please Kunal teach us programs on collection concepts such as list,set and map please.

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

    whenever you say, " no one can help you, you can't do it", then say "watch the previous videos" even when I have watched all, yet I got scared what bhaiya saying, am I that dumb, maybe I am, what should I do now, it's like a 1-year-old boy in between a fair lost.
    that's it.

  • @binitgupta9371
    @binitgupta9371 3 месяца назад +1

    Hey Guys for the Q4 you can also go with the below code :)
    //With obstacles Q4
    static ArrayList printPathRetObstacle(String p , int r , int c){
    if( r== 3 && c ==3){
    ArrayList list = new ArrayList();
    list.add(p);
    return list;
    }
    ArrayList list = new ArrayList();
    if( r < 3){
    if ( r== 2 && c ==2){
    return list;
    }else {
    list.addAll(printPathRetObstacle(p + "D", r + 1, c));
    }
    }
    if( c < 3){
    if( r==2 && c ==2){
    return list;
    }else {
    list.addAll(printPathRetObstacle(p + "R" , r ,c+1));
    }
    }
    return list;
    }

  • @PriyaSingh-zb5wn
    @PriyaSingh-zb5wn 5 месяцев назад +3

    watching long videos of recursion was worth it , can't thank you enough for these .🙏

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

    I think my code is easier to understand for backtracking:
    m = current row, n = current column, visited is initialised to all false, curr is the current string of path.
    void all(int m, int n, bool visited[3][3], string curr){
    if(m==2 && n == 2){
    cout

  • @CodeWithMe-N
    @CodeWithMe-N 4 месяца назад +3

    The way you explain the thought process, just WOW. Anyone can fall in love with recursion after watching this playlist.

  • @CodeWithMe-N
    @CodeWithMe-N 4 месяца назад +1

    ngl recursion has become my favourite after this playlist.

  • @rahulkumar-xu9rv
    @rahulkumar-xu9rv 3 месяца назад +1

    you are a genius kunal .

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

    Just, Amazimggggggggggggggggggggggggggggggggggg

  • @techyamanbyte
    @techyamanbyte 11 месяцев назад +4

    Kunal, your DSA videos are an absolute treasure! Your ability to break down complex concepts and provide a clear thought process for solving problems is truly remarkable. Your dedication to making these topics easy to understand is greatly appreciated. Thank you for your fantastic work!

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

    please start trees and graphs

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

    Love you're channel! I cant believe how much similar the approaches are. I would have never thought mazes and subsequences are soo similar!

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

    Kunal bro, you don't need to explain the things that you already explained in previous videos. I see you get frustrated while repeating it. Just can say, this is already done checkout xyz video, that's it! If still people are not getting it, they doesn't deserve as your audience. Keep up with your good work, man!!! Looking forward for your videos on DP, trees and graphs.

  • @shubhamagarwal7876
    @shubhamagarwal7876 2 года назад +23

    Never in my life I could have imagined to solve or understand these problems. Thanks Kunal for such an explanation that is so generic and applicable. Watching your JAVA videos I rocked all my java interviews. This playlist is super awesome. I thank you giving my career a boost and direction.

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

      bhai hamne 1:11:24 m condition false kyu add kri, jes ehi nice ki true condition hit kregi wo fir se false wale ko hit kregi, please explain

    • @akashprasad2556
      @akashprasad2556 Год назад +2

      @@nikhilchauhan3506
      If you haven't figured it out-
      Short answer - true wali statement tabhi execute hogi jab control return ho raha hoga.

  • @sahilgarg9340
    @sahilgarg9340 3 месяца назад +2

    Kunal, discovering your playlist is like finding a hidden gem-unexpected but incredibly rewarding. It's a fantastic collection for both students and professionals learning data structures and algorithms.

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

    Awesome videos👏👏👏. Please post videos on binary tree, graph and dynamic programming. Thank you!

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

    Kunal First of all thank you so much. I love the way you teach, you know how to teach what to teach. Amazing kunal, finally i feel i doing right teacher,
    And big thanks to you, your java videos helped me in cracking 10+LPA job as a fresher, thanks a lot @kunal

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

    Why
    in Q1 count function have terminate condition ( r==1 || c==1)
    In Q2 path function have terminate condition ( r==1 && c==1)
    Both function reports same thing so why conditions are different.
    I understand path (r==1 && c==1) clearly but can not understand count

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

    hey kunal do mark this timestamp as well 🤷‍♂️🤷‍♂️ 1:18:23 . Your first ever small rap on Arrays, somewhat similar to Bart's rap

  • @chandradithyak.g460
    @chandradithyak.g460 2 года назад +2

    Amazing explanation kunal. Was able to understand each and every step. Please make a video on generate all combinations of well-formed parentheses. I was seeing all videos for that question but was not able to understand it

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

    When will further topics be covered please let me know

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

    Eagerly waiting for the video on DP. Please upload it soon. 🙏🙏

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

    legendary as always

  • @anandj3616
    @anandj3616 11 месяцев назад +2

    literally solved all the questions before his explanation because of his previous recursion videos knowledge . kunal your recursion playlist is 🔥🔥🔥

    • @amithhd
      @amithhd 11 месяцев назад

      Hp wawawa 👌

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

    Thanks again for amazing videos, wanted to clarify one thing. The answer for paths when obstacle is there, isn't that wrong? Lets say I have 1 x 4 array and there is obstacle at 0,3 then answer shall be 0 but the code will print 1.

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

    Amazing teaching, Amazing thought process, The way how problems are being break down as per pattern, and they are so easy to understand and solve. Hats off to you kunal. Great work towards helping others with your skills.
    Thanks 🙂

  • @udayansingh6788
    @udayansingh6788 2 года назад +6

    Man this tutorial was sooooooo good!!!!! Before starting this series I never felt confident in recursion but today I was able to solve problems on my own. I can see that my problem solving skills have really improved. Thank you so much Kunal!! ❤❤

  • @KshitizAnand-xr1wj
    @KshitizAnand-xr1wj 9 дней назад

    I am really glad for having learned such a wonderful concept. Thank you for this video.

  • @SARVAGNAVEMULA
    @SARVAGNAVEMULA Месяц назад

    thank you, bro...🙏
    Today I am feeling sad...why I didn't find your videos before🥺

  • @satyampandey3136
    @satyampandey3136 2 месяца назад

    Thank you so much Kunal for these wonderful explanations. Requesting you to please provide the dynamic programming lecture link that you discuss in your lectures.

  • @abhishekgoud12
    @abhishekgoud12 8 месяцев назад +1

    Really the way this guy clears concept is something I have seen multiple video on rat maze but this man cleared all my doubts by solving same question using different ways. Specially that last question he printed entire matrix path this give me a clear picture of all recursion calls.

  • @arijitghosh397
    @arijitghosh397 Год назад

    //C++ code(Print the Matrix and Paths):
    void display(vector &vec)
    {
    int rows = vec.size();
    int cols = vec[0].size();
    for (int row = 0; row < rows; row++)
    {
    for (int col = 0; col < cols; col++)
    {
    cout

  • @Ayush-bk3rv
    @Ayush-bk3rv 2 года назад +1

    I dont even know these topics as im not from a cs background but i have faith in this guy, might not land a FANG company but definitely learning something new everyday

  • @shrutikanda
    @shrutikanda 4 месяца назад

    Thank you much Kunal for making this course . Just wondering when are you planning for Dynamic Programming and Graph series? Thanks once again .

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

    Hey bro, just wanted to let you know that I was able to do some problems in the video without actually watching it. Thanks to your previous videos in the playlist.

  • @subhankarkanrar9494
    @subhankarkanrar9494 7 месяцев назад

    I am enjoying your full course. I have one request for you --> Please complete it with DP.

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

    nice systematic approach. DO you have DP lectures ?

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

    Amazing explanation of backtracking kunal thanks a lot🙏 😊😊.

  • @RakshitBisht-bf7tw
    @RakshitBisht-bf7tw 3 месяца назад

    In the second question if we are going right where (r > 1) so we should do ( p + ' R ' ) in the if condition i guess. In the video the answer is same as we are going only right and down. Only the order of the possible answer is different.
    Am i right????

  • @DewanshJain-g4t
    @DewanshJain-g4t 3 месяца назад

    in q1 base conditon || operator was used but in q2 && was used...can anyone explain

  • @vikasseervi1500
    @vikasseervi1500 Год назад

    can anyone explain me why it give wrong answer if we use pre-increment operator instead of adding 1 in arguments?????
    for ex: ++r gives wrong answer whereas r+1 doesn't.

  • @MalobikaNandy
    @MalobikaNandy Месяц назад

    Absolutely incredible. Watched all the videos and able to understand the process and idea behind. Thanks a lot!

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

    When u gonna do video on OOP ?

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

    We can calculate no. of ways by nofmal permutation nothing else req like in 3*3 maze ans will be 4!/{2!*2!}

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

    Now we are readyyyyyyyyy for DP. Eagerly waiting

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

    Absolutely loved your dsa playlist, i have been watching since start. Also we make dev initiative is super helpful. After completing your dsa course i am going to study web dev from we make dev. But some topics of dsa you have still not covered, please complete the dsa playlist soon. I really appreciate the good work that you are doing, keep it up.

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

    Thank you soooo much, your explainations are incredible. Thank you, brother !!!!

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

    What an explanation 🔥🔥 starting with this topic again and watched this ..great start indeed💥

  • @gpraneeth7693
    @gpraneeth7693 2 месяца назад

    Sum of subsets equal to target is the best example for backtracking

  • @ashaysaoji2273
    @ashaysaoji2273 4 месяца назад

    At the timestamp 1:16:00, what Kunal meant is, LAVAL SABKE NIKLENGE🤣

  • @nishu0766
    @nishu0766 Месяц назад

    please upload all the remaining topics of this DSA playlist as soon as possible

  • @tripleh927
    @tripleh927 Год назад

    Recursion videos are great , but stop talking to yourself and saying the same thing again and again , its quite a bit annoying. :)

  • @lokesh3526
    @lokesh3526 2 года назад +3

    keep up the good work

  • @Developer-rt3cd
    @Developer-rt3cd 9 месяцев назад

    Can anyone give the code for backtracking for returning as arraylist

  • @vijaybenz9741
    @vijaybenz9741 Год назад

    if there's a river ,buy a boat.dont solve on pen and paper....jusrt 4 fun.

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

    Your codes are masterpiece , the more one understand them , the more they like it.
    Still , wisest are they who know that they don't know.

  • @Cloud-577
    @Cloud-577 2 года назад +1

    16 mins in and I had to stop because I need to check out those recursion vids

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

    Why Kunal Made this Course ?
    Already Explained 😂

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

    is it only me that feels like kunal gives gambhir vibes

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

    I didn't hear about back tracking before and for me now it is easy but when I have seen the comments I understand that Kunal had made it easy .What a way of explanation EXCELLENT Teaching Skills you have and thanks you for making the Playlist

  • @dineshmadduru7043
    @dineshmadduru7043 3 месяца назад

    Thanks for the video :) btw your rap is cool 😅

  • @nikhilrana1645
    @nikhilrana1645 10 месяцев назад

    Great video, I have watched all till here ......but there is wrong tree at 40:48

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

    Why he looks alike that nerdy hero from the movie "FALTU"?

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

    Dil se khushi hota hai yr aisa video dekh ke and most important topic smjh ke 🔥🔥🔥🔥🔥🔥🔥

  • @satnamsingh3801
    @satnamsingh3801 Год назад

    Good lecture if you want to learn copy pasting plus recursion.🤣

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

    Hey kunal do you have a bird? I can hear sound like that in your video.

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

    You not only explained the concept of backtracking but also explained why do we actually need it. Splendid explanation as always. Thank You!

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

    Amazing, such a smooth way to build up to the last complicated solution.

  • @TheMonkTalks-w6n
    @TheMonkTalks-w6n 6 месяцев назад

    If Kunal will react on this then I will crack Google 😂

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

    i cant express my thanks to this guy.. what a video.. 💥🔥

  • @swatibohidar1678
    @swatibohidar1678 Месяц назад

    Best Backtracking I have ever seen and understood

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

    I really enjoyed this lecture like binary search

  • @kartiklakra3227
    @kartiklakra3227 4 месяца назад

    In middle faltu ki baatoin thodi km ho Jaye toh sahi rehega , bhot bakwass

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

    can anyone plz help..why did he take boolean matrix

  • @AkVertasium232
    @AkVertasium232 26 дней назад

    sir i dont know why you stop making vedios

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

    Hi kunal, have you posted something on trees ?

  • @SK-oz7kr
    @SK-oz7kr Месяц назад

    At 16:03 "No one can help you" is so true...

  • @LowkeyCoder
    @LowkeyCoder Год назад

    after 30:00 it feels like i was in loop doing same thing anagin and again

  • @PrasannaKasar
    @PrasannaKasar 3 месяца назад

    The answer for Question 4 doesn't seem right. There are 2 ways other than DDRR and RRDD: Down, Diagonal, Right and Right, Diagonal, Down

    • @lokesh8660
      @lokesh8660 2 месяца назад

      he didn't used diagonal path and he clearly mentioned it is easy to change

  • @pratyakshtrivedi6694
    @pratyakshtrivedi6694 2 месяца назад

    BEAUTIFUL EXPLANATION MAN..........HATS OFF....🔥🔥🔥

  • @take_a_breath100
    @take_a_breath100 3 месяца назад

    Kunal is wow a intellectual human being ..

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

    When will the course continue pls tell me

  • @nasirkhansirajbhai8016
    @nasirkhansirajbhai8016 Год назад

    here is DP solution (with memoization) on top of Kunal's Maze solution.
    public static Long numberOfPaths(int row, int col, Map map) {
    if (row == 1 || col == 1)
    return 1L;

    if(map.containsKey(row+"-"+col))
    return map.get(row+"-"+col);

    Long left = numberOfPaths(row - 1, col, map);
    Long right = numberOfPaths(row, col - 1, map);
    map.put(row+"-"+col, left + right);
    return left + right;
    }

  • @funkyboy4882
    @funkyboy4882 8 месяцев назад

    1:14:16 par mujhe to sudoku khelna hi nahi aata, moye moye

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

    Backtracking code with pathprint when up, down, left, right is allowed:
    import java.util.*;
    public class Main
    {
    public static void main(String[] args) {
    // ArrayList anslist=new ArrayList();
    // anslist=list(0,0,"",2,new int[3][3]);
    // for(int i=0;i