Permutations (LeetCode 46) | Full solution with backtracking examples | Interview | Study Algorithms

preview_player
Показать описание

A very famous backtracking problem. Given an array of unique elements, find all the possible permutations. This video shows how to identify the logic which creates all different permutations. Once we know how to find permutations, we can map it to the backtracking algorithmic paradigm. The concept is super simplified using diagrams and visuals of state space tree. You will also find a dry-run of the code in JAVA.

Chapters:
00:00 - Intro
01:13 - Understanding the problem
02:51 - Logic to find permutations
06:43 - Using Backtracking to find permutations
11:52 - Dry-run of Code
15:36 - Final Thoughts

📚 Links to topics I talk about in the video:

📖 Reference Books:

🎥 My Recording Gear:

💻 Get Social 💻

#leetcode #backtracking #interview
Рекомендации по теме
Комментарии
Автор

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

srin
Автор

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!

billnye
Автор

Most of people that makes the videos on the YouTube 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.

mrboyban
Автор

I spent hours on this and ended up here. This motivates me to solve more problems of this type!

harshdhamecha
Автор

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!

rajeshpaithari
Автор

for sure this is the first time i have understood backtracking you have explained it better than in subsets video

johnmumo
Автор

finally a video where approach is explained rather than some pre-written code. keep it up.

AshutoshDhundhara
Автор

what simple easy explanation please don't stop making videos the way u explain its incredible TRUE LEGEND

arisahmed
Автор

one of the most clear and great explanation on this problem, thanks.

AlexTopGT
Автор

Thank you for creating such an amazing YouTube 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!

abhipraychavan
Автор

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 -:

ORagnar
Автор

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 !

poorpanda
Автор

Your Way Of Teaching Extreme Level And Simply Understandable

srikrishna_ss
Автор

Thank you so much sir, very good explanation, Please sir, make such kind of videos.

bhargavijethva
Автор

Excellent explanation, I finally understand backtracking. Thank you so much, sir!

TONY-httf
Автор

Best explanation ever ! Better than neetcode and all as well!

SaurabhSingh-qv
Автор

I've been struggling to understand backtracking but this vid is 10/10 great explanation thanks so much!

Goodday-nmzp
Автор

Wow sir, what a great code and an excellent explanation..

Aditya-wyci
Автор

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.

MrShubhamenx
Автор

thank you soo much! u explained is so nicely ^_^

celestialskies-covers