Subsets - Leetcode 78 - Recursive Backtracking (Python)

  Рет қаралды 9,841

Greg Hogg

Greg Hogg

Күн бұрын

Пікірлер: 35
@GregHogg
@GregHogg 3 ай бұрын
Master Data Structures & Algorithms For FREE at AlgoMap.io!
@NavneetKaur-x6q
@NavneetKaur-x6q Ай бұрын
After looking at several other videos, I finally found one where all my questions were answered. Loved the simplicity of the explanation whether whiteboard, coding part or the complexity.
@SHIHJUIheh
@SHIHJUIheh 4 ай бұрын
Thank you for explaining drawing part in detail, especially the recursive backtracking part ! You made this concept so much easier!!!
@GregHogg
@GregHogg 4 ай бұрын
You're very welcome 😎
@itsmenatika
@itsmenatika 27 күн бұрын
I've started understanding backtracking by that. In only 12 minutes. Thanks
@anothertechguy-q9g
@anothertechguy-q9g 2 ай бұрын
Thank you a lot for explaining the transitive parts of backtracking!
@FZRides
@FZRides 5 ай бұрын
Hi Greg, I found your video very intuitive. Thanks for sharing such content. Can you please make a video on "Tower of Hanoi" problem using recursion. I am unable to catch the recursive logic behind it. Can you please do it Sir.
@chisomedoka5651
@chisomedoka5651 5 ай бұрын
this is gold, so intuitive . Thanks for this
@kenkaneki5433
@kenkaneki5433 Ай бұрын
better than stp neetcode guy explanation
@olaf9063
@olaf9063 5 ай бұрын
Great explanation, thanks. Is the time complexity not O(n * 2^n) - reason being that at each of the terminal nodes you need to copy the list, which is an O(n) operation?
@henryhan8838
@henryhan8838 5 ай бұрын
You've inspired me, I was just wondering why we multiplied it by n.
@DivineEdoka
@DivineEdoka 2 ай бұрын
I'll like to see how you slve subset ii with this pattern as well
@sampjm1898
@sampjm1898 6 ай бұрын
you can use a dp solution : fn(n)=fn(n-1)+{fn(n-1) and put element_n in every set that return by fn(n-1)},cache the result of f(n).,f(n-1)..... consider you need to solve all the fn(n) you can write a bottom up dp solution, consider for each fn(n) only need f(n-1) you can just maintain one layer of cache so basic case is {[element_1],[empty]} for every element in the array add this element to each set and add this set back to the result: so the 2nd iteration: {[element_1],[empty], [element_1,element_2],[element_2]} and so on sorry for my English
@GregHogg
@GregHogg 6 ай бұрын
I'll have to look into this. Thanks so much for sharing!
@supremoluminary
@supremoluminary 5 ай бұрын
Do you have a link to this? I want to learn it. Thanks.
@shubhambajaj4939
@shubhambajaj4939 3 ай бұрын
brilliant solution. you just got yourself a new subscriber :)
@christianjt7018
@christianjt7018 3 ай бұрын
thanks Greg your explanations are the best!
@GregHogg
@GregHogg 3 ай бұрын
Bro I can see from the comments that you're just flying through these questions, good for you honestly!
@dusvn1484
@dusvn1484 Ай бұрын
Nice video,helped me a lot!
@nav213
@nav213 3 ай бұрын
Would backtracking have to do with recursion? Is it possible to solve this in a non-recursive way? I am asking because it's really difficult to understand the recursive implementation of the code unless you memorize it. Thanks again for you awesome tutorials!!!! cheers
@GregHogg
@GregHogg 3 ай бұрын
You can memorize the template for how this is done, I promise the best way is through recursion
@GarouNguyen
@GarouNguyen 4 ай бұрын
bro how do you move recursion left what is line 12 code back track i + 1 , why you have two backtrack(i+1) can you explain bro
@Alex-tm5hr
@Alex-tm5hr 27 күн бұрын
Can you pls make a vid for subsets 2?
@just4laughs140
@just4laughs140 3 ай бұрын
what does backtrack(i +1) mean
@phamh79
@phamh79 27 күн бұрын
many thanks.
@GarouNguyen
@GarouNguyen 4 ай бұрын
bro why don't pick and pick is same backtrack(i+1) and why you recursion left i + 1 i don't understand
@m.y.7230
@m.y.7230 4 ай бұрын
thanks for explaning dfs in drawing
@GregHogg
@GregHogg 4 ай бұрын
No problem!
@anti-dn541
@anti-dn541 6 ай бұрын
Easy to understand for noob like me 👍🏻
@GregHogg
@GregHogg 6 ай бұрын
Oh that's so great to hear 😊
@maskedoni3229
@maskedoni3229 6 ай бұрын
Great solution
@GregHogg
@GregHogg 6 ай бұрын
Thanks so much!
@Antinormanisto
@Antinormanisto 5 ай бұрын
I don't understand(
@GregHogg
@GregHogg 5 ай бұрын
Maybe try watching it again? Backtracking is REALLY confusing at first
@hrushik10
@hrushik10 3 ай бұрын
thanks
Permutations - Leetcode 46 - Recursive Backtracking (Python)
9:42
Rotting Oranges - Leetcode 994 - Graphs (Python)
16:09
Greg Hogg
Рет қаралды 3,3 М.
Ice Cream or Surprise Trip Around the World?
00:31
Hungry FAM
Рет қаралды 15 МЛН
За кого болели?😂
00:18
МЯТНАЯ ФАНТА
Рет қаралды 2,1 МЛН
風船をキャッチしろ!🎈 Balloon catch Challenges
00:57
はじめしゃちょー(hajime)
Рет қаралды 76 МЛН
Subsets - Backtracking - Leetcode 78
8:47
NeetCode
Рет қаралды 290 М.
15 Years Writing C++ - Advice for new programmers
4:04
SyncMain
Рет қаралды 1,2 МЛН
Pacific Atlantic Water Flow - Leetcode 417 - Graphs (Python)
17:10
I Solved 1583 Leetcode Questions  Here's What I Learned
20:37
ThePrimeTime
Рет қаралды 725 М.
LeetCode was HARD until I Learned these 15 Patterns
13:00
Ashish Pratap Singh
Рет қаралды 558 М.
How to Solve ANY LeetCode Problem (Step-by-Step)
12:37
Codebagel
Рет қаралды 293 М.
Ice Cream or Surprise Trip Around the World?
00:31
Hungry FAM
Рет қаралды 15 МЛН