when I was college I could not understand it. Spent hours, days reading about never understood it over a decade of time. I was so much depressed when some people understood it and I was not able to understand. But today I understood. Man , you best talent to explain concepts with 1) with simple example 2) simple words 3) with actual core concept instead of making people to mug up steps. Your awesome. There are many people from around the world who lack enough money to get good quality of education. Please keep doing Algo questions and leetcode questions. I also salute your parents for raising such patient and cool attitude, talking. Thankyou
Most of people that makes the videos on the TH-cam don't actually understand the fundamental of the subject, hence why it is poorly explained and makes everyone else confused as well. You're clearly know your stuff very well. Thanks for sharing your knowledge with us.
I watched 10's of videos on backtracking. Though I understood the logic, I wasn't able to put that into code. Finally, I made it and related this logic to phone pad permutations, permutations 2, subsets. Thanks man!
Your just amazing idk why people are not finding your channel but all i can do is pray for you to reach heights ,and yeah ofcourse i will share this channel thanks for helping us out
Watched your videos on recursion, backtracking, and now this video. I think I am finally understanding backtracking now after hours of trying. Thank you for the very clear examples. Your section 'Using backtracking to find permutations' helped me the best!
Thank you for creating such an amazing TH-cam channel! Your explanation on solving LeetCode problem with backtracking is incredibly clear and understandable. I've learned a lot from your video, and I'll definitely be following your channel from now on to learn new approaches and algorithms whenever I encounter challenging problems. Keep up the fantastic work!
This was fantastic! The thing that clarified it for me almost immediately was the tree diagram you gave in the beginning. This allows you to visualize the problem and solution. Great job! 6, 14 -:
we do temp.remove(temp.size() - 1); because we remove the recently added number, so its going to be the last number in the temp array, for anyone wondering
I dont agree on one point here when you say in comment " // Go back to try", at 13:35 this is misleading term "and go back" as anyone can think this is backtracking. When you remove the element, that is when actual backtracking takes place. Calling backtrack method recursively is not when backtracking happens. When you remove an element from a list, that is when you backtrack to previous path and then you wither add or call backtrack again to remove more elements to backtrack further up the path in the tree.
Just one thing backtrack method is really for going back and considering different choice OR it is taken care by pop() and then incrementing for loop further?
Hi , you explained it very nicely. Just want to say that your text based explanation link is taking to the Longest common prefix problem and not this permutations one , so please correct it , if you can :)
Sir a little correction. You said it will add 1 then backtrack and remove 1 and add 2 and then repeat to add 3. but according to your code it will first add 1 and then find out all possible permutations with 1 and then remove 1. I tried dry running it bcz i got confused that how it is adding 1 and then removing it before finding all the possible combinations. Am i correct?
I'm very weak in backtracking and dp, How can i become good in those things? what are the basic things to learn for becoming good in backtracking and dp?
one question, how do one make sure that after selecting one element from array, the previous and next numbers are included? loop makes sure next numbers in array are included. how are previous numbers from selected array are included in backtracking?
that is how recursion and backtracking work. when a function call ends, it will go back and resume where the recursive call started. Bactracking: th-cam.com/video/51Zy1ULau1s/w-d-xo.html Recursion: th-cam.com/video/FTTHkmnvzlM/w-d-xo.html
Unclear explanation, we are not going back every step. We simply use DFS alhoritm, which going back only when we hit the bottom of tree. So we going back when one leaf of permutations is constructed .
when I was college I could not understand it. Spent hours, days reading about never understood it over a decade of time. I was so much depressed when some people understood it and I was not able to understand. But today I understood. Man , you best talent to explain concepts with 1) with simple example 2) simple words 3) with actual core concept instead of making people to mug up steps. Your awesome. There are many people from around the world who lack enough money to get good quality of education. Please keep doing Algo questions and leetcode questions. I also salute your parents for raising such patient and cool attitude, talking. Thankyou
Nikhil is my GOAT
Same here
Most of people that makes the videos on the TH-cam don't actually understand the fundamental of the subject, hence why it is poorly explained and makes everyone else confused as well. You're clearly know your stuff very well. Thanks for sharing your knowledge with us.
I watched 10's of videos on backtracking. Though I understood the logic, I wasn't able to put that into code. Finally, I made it and related this logic to phone pad permutations, permutations 2, subsets. Thanks man!
Your just amazing idk why people are not finding your channel but all i can do is pray for you to reach heights ,and yeah ofcourse i will share this channel thanks for helping us out
You're the best!
finally a video where approach is explained rather than some pre-written code. keep it up.
i really believe in understanding the logic, rather than just solving it.. :)
Watched your videos on recursion, backtracking, and now this video. I think I am finally understanding backtracking now after hours of trying. Thank you for the very clear examples. Your section 'Using backtracking to find permutations' helped me the best!
for sure this is the first time i have understood backtracking you have explained it better than in subsets video
what simple easy explanation please don't stop making videos the way u explain its incredible TRUE LEGEND
I spent hours on this and ended up here. This motivates me to solve more problems of this type!
one of the most clear and great explanation on this problem, thanks.
Thank you for creating such an amazing TH-cam channel! Your explanation on solving LeetCode problem with backtracking is incredibly clear and understandable. I've learned a lot from your video, and I'll definitely be following your channel from now on to learn new approaches and algorithms whenever I encounter challenging problems. Keep up the fantastic work!
thanks for the support. :)
Really appreciate your efforts, man.
This was fantastic! The thing that clarified it for me almost immediately was the tree diagram you gave in the beginning. This allows you to visualize the problem and solution. Great job!
6, 14 -:
Thanks for the lovely feedback.
Thank you so much I spend 4 hours trying to find a good solution that explains with recursive tree. Found your video & I'm really happy... Thank you !
Your Way Of Teaching Extreme Level And Simply Understandable
Best explanation ever ! Better than neetcode and all as well!
Thank you so much sir . A savior!!
Thank you so much sir, very good explanation, Please sir, make such kind of videos.
I've been struggling to understand backtracking but this vid is 10/10 great explanation thanks so much!
Great to hear!
Very well explained!!! Keep it up.
Wow sir, what a great code and an excellent explanation..
we do temp.remove(temp.size() - 1);
because we remove the recently added number, so its going to be the last number in the temp array, for anyone wondering
You made it very easy to understand
Excellent explanation, I finally understand backtracking. Thank you so much, sir!
That was a masterclass. Many thanks!
u are a godsend
love you bhaiya your amazing solution as well as amazing approach
Hi, would u further explain when u said "array of length n will have total of n! permutations" and "when n is the stack space that you are choosing"?
best explanation out there
I dont agree on one point here when you say in comment " // Go back to try", at 13:35 this is misleading term "and go back" as anyone can think this is backtracking. When you remove the element, that is when actual backtracking takes place. Calling backtrack method recursively is not when backtracking happens. When you remove an element from a list, that is when you backtrack to previous path and then you wither add or call backtrack again to remove more elements to backtrack further up the path in the tree.
very very nice explanation
Excellent explanation
please make full series on recursion , you are dammmmmm good bro
gonna compile it very soon
It was very well explained , thanks a lot :)
You are the best
simply the best
thank you soo much! u explained is so nicely ^_^
Thank you brother
thank buddy are you lot of help me'
Great explanation sir.
Thanks and welcome
Just one thing
backtrack method is really for going back and considering different choice OR it is taken care by pop() and then incrementing for loop further?
backtrack method kind of helps you to explore the complete state tree. Watch my video on backtracking to understand more
Hi , you explained it very nicely.
Just want to say that your text based explanation link is taking to the Longest common prefix problem and not this permutations one , so please correct it , if you can :)
Sir a little correction. You said it will add 1 then backtrack and remove 1 and add 2 and then repeat to add 3. but according to your code it will first add 1 and then find out all possible permutations with 1 and then remove 1. I tried dry running it bcz i got confused that how it is adding 1 and then removing it before finding all the possible combinations. Am i correct?
Yes, backtracking is DFS, it will first go deep on one node then will backtrack when all options are over and continue to next branch.
Thanku bhai
please make video for "smallest good base --> leetcode =483"....🙏🙏🙏🙏
that is not a good quality problem. watch this video on selecting problems: th-cam.com/video/PcolzuB-fRc/w-d-xo.html
I have a question, wouldn’t the time complexity of contains method be counted which is O(n)?
With a hashset, the contains method works in O(1)
For an ArrayList, the complexity of the contains() method is O(n).
I'm very weak in backtracking and dp, How can i become good in those things?
what are the basic things to learn for becoming good in backtracking and dp?
practice, practice, practice......and a lot lot of practice...there is no other shortcut my friend. :)
Good one
one question, how do one make sure that after selecting one element from array, the previous and next numbers are included? loop makes sure next numbers in array are included. how are previous numbers from selected array are included in backtracking?
that is how recursion and backtracking work. when a function call ends, it will go back and resume where the recursive call started.
Bactracking: th-cam.com/video/51Zy1ULau1s/w-d-xo.html
Recursion: th-cam.com/video/FTTHkmnvzlM/w-d-xo.html
thanks!!
i got to know how to implement backtracking in code
Thanks!
you are welcome!!
in last video of subsets i did not understand how i we got [1,3] please do write the recursive tree once
In subsets, if you watch 8:29...we get a state of choosing the 2nd element. Extend it for the 3rd element at 8:52
rest all r good
Bro make videos to solve matrices problems plzz.
I will add them to my pipeline. Do you have a particular problem in mind?
i understood the question but dont no the code.plzzz exapin it broo😢😢
@@pradeeps9633 which part are you facing a problem with? May be I can clarify even more.
@@nikoo28 bro i have no idea to solve matrice type question.Every time i see it looks like a new one.
NIce
Unclear explanation, we are not going back every step. We simply use DFS alhoritm, which going back only when we hit the bottom of tree. So we going back when one leaf of permutations is constructed .
Please fix your audio
which part did you face a problem with?
volume was really very low
Sorry for the inconvenience…I have fixed it in my recent videos.
Please check them out and let me know if it is still an issue.
watch 10:05 see face
tempList.contains(number) - This is O(n) operation