Backtracking Introduction + Maze Problems - Theory + Code + Tips

  Рет қаралды 167,972

Kunal Kushwaha

2 жыл бұрын

This video covers an introduction to #backtracking, along with maze path problems. An important video for interviews covering complete theory + code + tips.
Register now for the Battlesnake fall league: play.battlesnake.com/league/fall-league-2021/
Take part in the learning in public initiative! Share your learnings on LinkedIn and Twitter with #DSAwithKunal & don't forget to tag us!
👉 Resources
- Join Replit: join.replit.com/kunal-kushwaha
- Complete Java DSA playlist: kzbin.info/aero/PL9gnSGHSqcnr_DxHsP7AW9ftq0AtAyYqJ
- Code, Assignments, & Notes: github.com/kunal-kushwaha/DSA-Bootcamp-Java
➡️ Connect with me: kunalkushwaha.com
=========================================
Timestamps:
0:00:00 Teaser
0:00:31 Introduction
0:01:51 Maze Problems
0:03:11 Q1 : Counting Paths
0:18:08 Code for Q1
0:20:58 Q2 : Printing Paths
0:27:00 Code for Q2
0:32:18 Q3 : Including Diagonal Paths
0:35:30 Q4 : Maze with Obstacles
0:40:43 Code for Q4
0:47:55 Q5 : Including All Paths
0:51:51 Explanation for Q5
1:07:04 Backtracking Introduction
1:11:01 Code for Q5
1:14:43 Q6 : Print Matrix and Paths
1:20:44 Code for Q6
1:25:37 Battlesnake Fall League
1:27:52 Outro
#recursion #placement #dsa #interviews

Пікірлер: 275
@rohitchilhorkar8114
@rohitchilhorkar8114 2 жыл бұрын
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 жыл бұрын
Glad it was helpful!
@ALister_priyanshu
@ALister_priyanshu 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 жыл бұрын
@@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 10 ай бұрын
​@@KunalKushwahaHello sir can you help me in a program . I'm struggling. can you send your email I'd...
@kalpeshmali1476
@kalpeshmali1476 2 жыл бұрын
finally a teacher who understand that this topics are important to cover in depth and u have done this job 🔥🔥🔥🔥🔥
@nousheen05
@nousheen05 8 күн бұрын
The way you explain the thought process, just WOW. Anyone can fall in love with recursion after watching this playlist.
@shaunvarghese3400
@shaunvarghese3400 2 жыл бұрын
This is the first time i am learning backtracking....and i am glad i bumped into THIS video....very well explained....thanks Kunal...👌🙌
@KunalKushwaha
@KunalKushwaha 2 жыл бұрын
Great to hear!
@techyamanbyte
@techyamanbyte 7 ай бұрын
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!
@determinator4491
@determinator4491 2 жыл бұрын
Love you're channel! I cant believe how much similar the approaches are. I would have never thought mazes and subsequences are soo similar!
@ankit_1012
@ankit_1012 2 жыл бұрын
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 жыл бұрын
Thanks! Do it at your own pace.
@felixboachieyiadom4457
@felixboachieyiadom4457 Жыл бұрын
@@KunalKushwaha please do dp I'm struggling a bit with it
@shubhamagarwal7876
@shubhamagarwal7876 Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
@@nikhilchauhan3506 If you haven't figured it out- Short answer - true wali statement tabhi execute hogi jab control return ho raha hoga.
@chitvangarg201
@chitvangarg201 2 жыл бұрын
your teaching skill is just amazing i had enrolled around 10 courses but i never get such understanding of concept as i got with your lectures, thanks a bunch for providing this great DSA course for free
@PriyaSingh-zb5wn
@PriyaSingh-zb5wn Ай бұрын
watching long videos of recursion was worth it , can't thank you enough for these .🙏
@de-codr8814
@de-codr8814 2 жыл бұрын
best explanation available on youtube, literally the concept got imprinted in my mind, Kunal is too OP.
@dickharry910
@dickharry910 Жыл бұрын
While there is no dearth of online tutorials and resources available to explain these difficult and complex topics, few themselves have the clarity of these hard to grasp concepts and nobody so far explained them with such great clarity as you have done. Words fail me to express my gratitude for you. I just want to thank you from the bottom of my ❤ for the great work you are doing 🙏🙏💐
@dipalitusharvlogs7252
@dipalitusharvlogs7252 7 ай бұрын
There is no doubt about Kunal's teaching skills, The way he looks at camera, feels like he is Infront of me and teaching 💚
@abhishekgoud12
@abhishekgoud12 4 ай бұрын
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.
@jamespeterson7824
@jamespeterson7824 Жыл бұрын
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 🙂
@chaitanyaprasad6924
@chaitanyaprasad6924 2 жыл бұрын
This is Amazing!! Understood BackTracking like a charm!!! Now I;ll try Sudoko solver on my own and I'm confident I can solve it because of how clearly you taught this!!!
@siddharthupadhyay4246
@siddharthupadhyay4246 2 жыл бұрын
Amazing, such a smooth way to build up to the last complicated solution.
@nousheen05
@nousheen05 8 күн бұрын
ngl recursion has become my favourite after this playlist.
@kanakkanak1520
@kanakkanak1520 2 жыл бұрын
Thank you for making the recursion concept so easy😊 also, for breaking the myth 21:52, I believed in it for the longest time
@pratikshar344
@pratikshar344 2 жыл бұрын
What an explanation 🔥🔥 starting with this topic again and watched this ..great start indeed💥
@ankurtiwari9621
@ankurtiwari9621 6 ай бұрын
Loved this playlist..Making hard things look so easy..highly recommend this course to any software developer , if wanted to learn the concept ( irrespective of the language). Kudos !!
@sukanyapawal6376
@sukanyapawal6376 Жыл бұрын
Best explanation. I never knew what backtracking was, but after watching this video I understood the concept in depth. Thankyou Kunal Bhaiyya!
@davidmwangi4312
@davidmwangi4312 2 жыл бұрын
Thanks, Kunal for this Amazing series. Keep up the good work Man.
@user-ge8cg8yy6n
@user-ge8cg8yy6n 11 ай бұрын
After watching your video's I've got next level of confidence to solve recursion problems.. You are a very good at simplifying concepts.. Thank you
@edukondalugumma3753
@edukondalugumma3753 2 жыл бұрын
Awesome Kunal. I just started learning these DSA. Its so interesting with your videos. Kudos
@chandradithyak.g460
@chandradithyak.g460 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
@milan_20
@milan_20 6 ай бұрын
There's nothing simple concept explanation like this... Ever seen💯👌🏻
@robin5862
@robin5862 Жыл бұрын
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.
@manishkasera8584
@manishkasera8584 2 жыл бұрын
Dil se khushi hota hai yr aisa video dekh ke and most important topic smjh ke 🔥🔥🔥🔥🔥🔥🔥
@anshulporwal3957
@anshulporwal3957 10 күн бұрын
Just awesome. The best video available for backtracking. Hats off to you Kunal.
@KunalKushwaha
@KunalKushwaha 10 күн бұрын
Glad you liked it!
@fxtstudios3285
@fxtstudios3285 Жыл бұрын
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.
@haripriyaveluchamy9449
@haripriyaveluchamy9449 9 ай бұрын
kunal... when i saw the last problem solution without my knowledge i clapped and shouted ....... u r great ...
@devjeff3192
@devjeff3192 Жыл бұрын
Thank you soooo much, your explainations are incredible. Thank you, brother !!!!
@anandj3616
@anandj3616 7 ай бұрын
literally solved all the questions before his explanation because of his previous recursion videos knowledge . kunal your recursion playlist is 🔥🔥🔥
@amithhd
@amithhd 7 ай бұрын
Hp wawawa 👌
@subham54321
@subham54321 2 жыл бұрын
Hi Kunal, your course is THE BEST. please release the video of OOP, when can we expect the OOP video?
@manojgollapelli9856
@manojgollapelli9856 2 жыл бұрын
i cant express my thanks to this guy.. what a video.. 💥🔥
@aarya3605
@aarya3605 2 жыл бұрын
The way u explain is next level seriously 💯
@preciso5831
@preciso5831 2 жыл бұрын
Best backtracking and recrusion explanation video all over the internet for beginners.
@aInvincibleProgramer789
@aInvincibleProgramer789 Жыл бұрын
Mene apka playlist dekh krr phla question khud se bnaya aur baki ke bhi bna dala thanxx bhaiya 😍❤❤
@100Days-nt6cx
@100Days-nt6cx 2 ай бұрын
Such a nice video. You have created interest of tech inside me. Loved watching your video.
@aakashmalhotra3157
@aakashmalhotra3157 2 жыл бұрын
Even a cpp student also watching these videos because such awesome content is not available for cpp.
@cdp1191
@cdp1191 10 ай бұрын
This is the best course on KZbin thanks Kunal Kushwah
@hargunsingh8800
@hargunsingh8800 Жыл бұрын
Hi Kunal, Your recursion playlist on KZbin has been a game-changer for me! I have learned so much and have been able to apply the concepts in my coding projects. I would love to see a new lecture series on dynamic programming. I know it's a challenging topic, but I trust your teaching style and explanations to make it more approachable. Keep up the great work!.
@shrutikanda
@shrutikanda 19 күн бұрын
Thank you much Kunal for making this course . Just wondering when are you planning for Dynamic Programming and Graph series? Thanks once again .
@indukumari193
@indukumari193 2 жыл бұрын
Amazing explanation of backtracking kunal thanks a lot🙏 😊😊.
@v19993
@v19993 2 жыл бұрын
Seriously bro ,you are incredible.
@exe.m1dn1ght
@exe.m1dn1ght Ай бұрын
God bless your kind heart Kunal
@saitejakatta1156
@saitejakatta1156 Жыл бұрын
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
@KunalKushwaha
@KunalKushwaha Жыл бұрын
Thanks for sharing
@mukuljain7845
@mukuljain7845 2 жыл бұрын
Amazing explanation of Backtracking, thanks man!!!!
@user-bd7fo1wv9b
@user-bd7fo1wv9b 2 ай бұрын
Dear Kunal, We have no words to thank you! You litertly save us in our degree. Are there videos about dynamic programming already?
@akshaykumar-wd8jc
@akshaykumar-wd8jc 2 жыл бұрын
Woww great content man love ur course
@PiyushYadav-jn7se
@PiyushYadav-jn7se 24 күн бұрын
you are amazing kunal sir
@shofiyabootwala2094
@shofiyabootwala2094 2 жыл бұрын
You not only explained the concept of backtracking but also explained why do we actually need it. Splendid explanation as always. Thank You!
@mohamedabdulla8097
@mohamedabdulla8097 2 жыл бұрын
Excellent explaination about Backtracking 🔥
@Ayush-bk3rv
@Ayush-bk3rv 2 жыл бұрын
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
@rsambas
@rsambas 2 жыл бұрын
Awesome videos👏👏👏. Please post videos on binary tree, graph and dynamic programming. Thank you!
@shivamkumarchaudhary2679
@shivamkumarchaudhary2679 Жыл бұрын
I really enjoyed this lecture like binary search
@arjunmangali2904
@arjunmangali2904 8 ай бұрын
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
@aakashyadav9117
@aakashyadav9117 Жыл бұрын
you explained backtracking so easily bro 🙌
@rishabhrawat8197
@rishabhrawat8197 2 жыл бұрын
kunal you explained it very well and ah u made my life easy hats off
@KunalKushwaha
@KunalKushwaha 2 жыл бұрын
Thank You
@divyasaivaddhi2729
@divyasaivaddhi2729 Жыл бұрын
thank you for this amazing playlist 👍👌
@shobhitupadhyay4711
@shobhitupadhyay4711 2 ай бұрын
Man !!!!!!!!, bhaiyaa i am always fascinated by the way you teach in every video why aren't you the CEO of Goggle already😭😭
@udayansingh6788
@udayansingh6788 Жыл бұрын
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!! ❤❤
@subhankarkanrar9494
@subhankarkanrar9494 3 ай бұрын
I am enjoying your full course. I have one request for you --> Please complete it with DP.
@azmat6428
@azmat6428 Жыл бұрын
At some points when I see you, I kinda get laugh. Anyway I love your teaching bro. Thanks a lot man. You are helping every person who are need of learning DSA and JAVA.
@kushalsarda3435
@kushalsarda3435 2 жыл бұрын
Pleaseeee make video on DP plzzzz, ur teaching is the perfect way, we have forget to memorize... just understand and apply thankss a lot!!
@cindrasenareddy1929
@cindrasenareddy1929 Жыл бұрын
legendary as always
@rockya007
@rockya007 Жыл бұрын
kind of satisfaction after learning all this stuff is priceless
@yashtibra3684
@yashtibra3684 2 жыл бұрын
Simply Amazing.
@aishikpal7139
@aishikpal7139 Жыл бұрын
Eagerly waiting for the video on DP. Please upload it soon. 🙏🙏
@princekoshti7245
@princekoshti7245 10 ай бұрын
I always wanted to be taught like this :-) Thanks bhaiya
@RAHULRAJ-et9se
@RAHULRAJ-et9se 9 ай бұрын
this man is insane ❤‍🔥
@chandrus5847
@chandrus5847 Ай бұрын
best best best the best Explanation in the world
@anindabarua6233
@anindabarua6233 8 ай бұрын
Great Explanation 😊
@PradeepYadav-fg2yg
@PradeepYadav-fg2yg 2 жыл бұрын
28:44 the way problem was solved left me in awwww 🙏🙏🙏🙏
@260_arnabkumarbaishya9
@260_arnabkumarbaishya9 2 жыл бұрын
This man shaping my future :)
@girirajtomar519
@girirajtomar519 2 жыл бұрын
Best Backtracking lecture bhai !!
@prasadshinde192
@prasadshinde192 Жыл бұрын
hats off to you Kunal
@sauravkalita2006
@sauravkalita2006 Жыл бұрын
I must say Kunal, I was having a hard time understanding backtracking and other concepts in my college years as the teacher overcomplicated things when they were teaching these concepts. But the way you taught in these videos with such an innovative way, I can understand it so easily and I finally can feel confident whenever I tackle with such problems. Thank you Kunal and a Happy Teacher's Day
@dibbyarupdutta3525
@dibbyarupdutta3525 Жыл бұрын
There's no match for the way you explain things Kunal.
@utkarshsharma1185
@utkarshsharma1185 2 жыл бұрын
You really made Maze's questions so simple thanks, brother.
@KunalKushwaha
@KunalKushwaha 2 жыл бұрын
You are most welcome
@lokesh3526
@lokesh3526 2 жыл бұрын
keep up the good work
@bhavyabansal1143
@bhavyabansal1143 2 жыл бұрын
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.
@deekshithpranav1619
@deekshithpranav1619 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.
@KunalKushwaha
@KunalKushwaha 2 жыл бұрын
Great to hear!
@gowtham9153
@gowtham9153 6 ай бұрын
1:11:05 Is the if condition needed? Because we are changing the paths to true while returning so there is no possibility for false in anyother visited array
@anassaif3181
@anassaif3181 2 жыл бұрын
Kunal ...you have got now 200K Subscribers.... Now plz continue the DSA Bootcamp..🥺...
@lyricalbeatz224
@lyricalbeatz224 2 жыл бұрын
Really I'm solving recursive programs .It's only because of u .
@anmolsharma9539
@anmolsharma9539 2 жыл бұрын
Hi Kunal thanks for the video really appreciated the hard work you put in it. In the last question I stuck at a very interesting part I was trying to add the path in the arraylist by passing it in the arguments of the function. I realized even though the list is not static same reference of the path is stored in the list again and again . It's obvious since all the array is pointing to the same reference . Then I try to create a new array every time by new keyword and then System.arrayCopy but still the same array reference is there printing the last value n number of times. Did you know any way in which I can store it in the arraylist while preserving all the values . I tried to look it in different website will add in the thread if I found it . Happy Learning : )
@thenomad8750
@thenomad8750 Жыл бұрын
bro WTF why is this playlist put to halt. This playlist is legit knowldge provider. it should continue. placements are near.
@logic2789
@logic2789 2 жыл бұрын
watched your entire recursion playlist I must say, you just made recursion very easy(atleast for me). Permutations, subsequences you made them easy for me, I was able to solve many of its applications with slight variations. Thank you Kunal for making this amazing playlist you always make complicated topics easy for us.
@Shourya_performs
@Shourya_performs 2 жыл бұрын
Now we are readyyyyyyyyy for DP. Eagerly waiting
@tarunpahuja3443
@tarunpahuja3443 2 жыл бұрын
nice systematic approach. DO you have DP lectures ?
@youwillyoucan
@youwillyoucan 2 жыл бұрын
i have learned a lot from your videos, will you please update us when will you end this course. please give us some idea bro it really helps us to set other goals. again thanks for this course👌✌
@sweetyprasad287
@sweetyprasad287 2 ай бұрын
Thank you ❤
@rishablath14
@rishablath14 11 ай бұрын
Hey, Kunal just want to appreciate you and want to know who just taught you this like the explanation and the depth knowledge is pro. Thanks for the efforts and video...🤝😄❤️
@KunalKushwaha
@KunalKushwaha 11 ай бұрын
So nice of you
@antosha2224
@antosha2224 Жыл бұрын
Thank you do much!
@yashvantsinhchavda3711
@yashvantsinhchavda3711 Жыл бұрын
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
@ankitmishra5945
@ankitmishra5945 9 ай бұрын
When you will upload DP video???? By the way, this playlist is super awesome. I thank you giving my career a boost and direction.
@aminefourati1258
@aminefourati1258 8 ай бұрын
excellent !
@malavipande6693
@malavipande6693 Жыл бұрын
We are blessed having teacher like you kunal sir!🤗
@malavipande6693
@malavipande6693 Жыл бұрын
@@nikhilchauhan3506 can you elaborate in English please !
@nikhilchauhan3506
@nikhilchauhan3506 Жыл бұрын
​@@malavipande6693 i got the answer, btw thanks for your assist
@malavipande6693
@malavipande6693 Жыл бұрын
@@nikhilchauhan3506 Even though I have to know cloud you please tell me in english.
@nikhilchauhan3506
@nikhilchauhan3506 Жыл бұрын
@@malavipande6693 cloud?
@malavipande6693
@malavipande6693 Жыл бұрын
@@nikhilchauhan3506 typo error that's could