Subsets - Leetcode 78 - Recursive Backtracking (Python)

The Python code for this problem can be found at my GitHub repo here: github.com/gahogg/Leetcode-So...
Please check my playlists for free DSA problem solutions:
• Arrays, Strings, and H...
• 2 Pointers Questions
• Sliding Window Questions
• Binary Search Questions
• Stack Questions
• Linked List Questions
• Binary Tree & Binary S...
• Heap Questions
• Recursive Backtracking...
• Graph Questions
• Dynamic Programming (D...
Learn Python and Data Science at mlnow.ai :)
Best Courses for Analytics:
---------------------------------------------------------------------------------------------------------
+ IBM Data Science (Python): bit.ly/3Rn00ZA
+ Google Analytics (R): bit.ly/3cPikLQ
+ SQL Basics: bit.ly/3Bd9nFu
Best Courses for Programming:
---------------------------------------------------------------------------------------------------------
+ Data Science in R: bit.ly/3RhvfFp
+ Python for Everybody: bit.ly/3ARQ1Ei
+ Data Structures & Algorithms: bit.ly/3CYR6wR
Best Courses for Machine Learning:
---------------------------------------------------------------------------------------------------------
+ Math Prerequisites: bit.ly/3ASUtTi
+ Machine Learning: bit.ly/3d1QATT
+ Deep Learning: bit.ly/3KPfint
+ ML Ops: bit.ly/3AWRrxE
Best Courses for Statistics:
---------------------------------------------------------------------------------------------------------
+ Introduction to Statistics: bit.ly/3QkEgvM
+ Statistics with Python: bit.ly/3BfwejF
+ Statistics with R: bit.ly/3QkicBJ
Best Courses for Big Data:
---------------------------------------------------------------------------------------------------------
+ Google Cloud Data Engineering: bit.ly/3RjHJw6
+ AWS Data Science: bit.ly/3TKnoBS
+ Big Data Specialization: bit.ly/3ANqSut
More Courses:
---------------------------------------------------------------------------------------------------------
+ Tableau: bit.ly/3q966AN
+ Excel: bit.ly/3RBxind
+ Computer Vision: bit.ly/3esxVS5
+ Natural Language Processing: bit.ly/3edXAgW
+ IBM Dev Ops: bit.ly/3RlVKt2
+ IBM Full Stack Cloud: bit.ly/3x0pOm6
+ Object Oriented Programming (Java): bit.ly/3Bfjn0K
+ TensorFlow Advanced Techniques: bit.ly/3BePQV2
+ TensorFlow Data and Deployment: bit.ly/3BbC5Xb
+ Generative Adversarial Networks / GANs (PyTorch): bit.ly/3RHQiRj
Become a Member of the Channel! bit.ly/3oOMrVH
Follow me on LinkedIn! / greghogg
Full Disclosure:
Please note that I may earn a commission for purchases made at the above sites! I strongly believe in the material provided; I only recommend what I truly think is great. If you do choose to make purchases through these links; thank you for supporting the channel, it helps me make more free content like this!

Пікірлер: 12

  • @FZRides
    @FZRides2 күн бұрын

    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.

  • @olaf9063
    @olaf906316 күн бұрын

    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

    14 күн бұрын

    You've inspired me, I was just wondering why we multiplied it by n.

  • @sampjm1898
    @sampjm1898Ай бұрын

    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

    Ай бұрын

    I'll have to look into this. Thanks so much for sharing!

  • @supremoluminary

    @supremoluminary

    23 күн бұрын

    Do you have a link to this? I want to learn it. Thanks.

  • @maskedoni3229
    @maskedoni3229Ай бұрын

    Great solution

  • @GregHogg

    @GregHogg

    Ай бұрын

    Thanks so much!

  • @anti-dn541
    @anti-dn541Ай бұрын

    Easy to understand for noob like me 👍🏻

  • @GregHogg

    @GregHogg

    Ай бұрын

    Oh that's so great to hear 😊

  • @Antinormanisto
    @Antinormanisto21 күн бұрын

    I don't understand(

  • @GregHogg

    @GregHogg

    21 күн бұрын

    Maybe try watching it again? Backtracking is REALLY confusing at first