Subsets | LeetCode 78 | C++, Java, Python | Power Set

Sdílet
Vložit
  • čas přidán 29. 07. 2024
  • Data Structures & Algorithms course: www.udemy.com/course/data-str...
    LeetCode Solutions: • LeetCode Solutions | L...
    June LeetCoding Challenge: • Playlist
    May LeetCoding Challenge: • Playlist
    Github Link:
    *** Best Books For Data Structures & Algorithms for Interviews:*********
    1. Cracking the Coding Interview: amzn.to/2WeO3eO
    2. Cracking the Coding Interview Paperback: amzn.to/3aSSe3Q
    3. Coding Interview Questions - Narasimha Karumanchi: amzn.to/3cYqjkV
    4. Data Structures and Algorithms Made Easy - N. Karumanchi: amzn.to/2U8FrDt
    5. Data Structures & Algorithms made Easy in Java - N. Karumanchi: amzn.to/2U0qZgY
    6. Introduction to Algorithms - CLR - Cormen, Leiserson, Rivest: amzn.to/2Wdp8rZ
    *****************************************************************************
    00:05 - Recursive Solution
    17:18 - Iterative solution
    July LeetCoding Challenge | Problem 11 | Subsets | 11 July,
    Facebook Coding Interview question,
    google coding interview question,
    leetcode,
    Subsets,
    Subsets c++,
    Subsets Java,
    Subsets python,
    Subsets solution,
    78. Subsets,
    #CodingInterview #LeetCode #JulyLeetCodingChallenge #Google #Amazon #Subsets #powerset
    00:05 - Recursive Solution
    17:18 - Iterative solution

Komentáře • 55

  • @theawless
    @theawless Před 3 lety +10

    I like how you first explain the theory and THEN write the code. A lot of youtubers just explain their pre-written code which is not helpful at all.
    And the best part about your video is that you gave all variations for the solution! Wow. Crazy good content right here.

    • @KnowledgeCenter
      @KnowledgeCenter  Před 3 lety

      Thanks. Glad it was helpful!

    • @denverelisha7878
      @denverelisha7878 Před 2 lety

      I guess im asking randomly but does anyone know of a tool to log back into an instagram account??
      I was stupid forgot the account password. I love any tricks you can offer me

    • @nashaugust6765
      @nashaugust6765 Před 2 lety

      @Denver Elisha Instablaster =)

    • @denverelisha7878
      @denverelisha7878 Před 2 lety

      @Nash August I really appreciate your reply. I got to the site on google and I'm waiting for the hacking stuff atm.
      Seems to take a while so I will get back to you later with my results.

    • @denverelisha7878
      @denverelisha7878 Před 2 lety

      @Nash August it worked and I finally got access to my account again. I'm so happy!
      Thank you so much, you saved my account :D

  • @Talhaguy
    @Talhaguy Před 3 lety +9

    Watched a few videos and read a few articles on this. This is by FAR the best explanation I've seen and I FINALLY understand it! Thank you!

  • @kevinle5772
    @kevinle5772 Před 3 lety +4

    Can someone explain to me his calculation at 18:35 please?
    I thought the sum would just be: 2^0 + 2^1 + 2^2 .... + 2^(n - 1) => O(2^n)
    Why does he have: 1 * 2^0 + 2 * 2^1 + 3 * 2^2 + .... => O(n * 2^n), which is much slower than O(2^n)
    This really drives me crazy.

  • @janmichaelaustria620
    @janmichaelaustria620 Před 4 lety +8

    Thank you good sir! This was probably the best explanation for this problem! You are a god send!

    • @KnowledgeCenter
      @KnowledgeCenter  Před 4 lety

      Thanks.

    • @kevinle5772
      @kevinle5772 Před 3 lety

      @@KnowledgeCenter Can someone explain to me his calculation at 18:35 please?
      I thought the sum would just be: 2^0 + 2^1 + 2^2 .... + 2^(n - 1) => O(2^n)
      Why does he have: 1 * 2^0 + 2 * 2^1 + 3 * 2^2 + .... => O(n * 2^n), which is much slower than O(2^n)
      This really drives me crazy.

  • @chandup832
    @chandup832 Před 3 lety +1

    How would do for subsets ii problem(if it contains duplicates?) in iterative way?

  • @raviashwin1157
    @raviashwin1157 Před 4 lety +8

    Back to back videos ... great job sir...I am completely dependent on you.... can you please upload some videos on linked list

  • @Rajat-Sharma1
    @Rajat-Sharma1 Před 3 lety +1

    Such an amazing explanation!! I was completely able to visualize the recursion!! Thanks!!

  • @VenkatIyer
    @VenkatIyer Před 2 lety +1

    In the first iteration n=result.size() will give a value of 0 right? How does it enter the loop then? Also, assigning result[i] to r is really cool. I did not know we can assign a value directly to a vector without indexing. Is my understanding correct?

  • @yashkute2350
    @yashkute2350 Před 3 lety +1

    And how about the power set in lexicographical order?

  • @afzalchishti9092
    @afzalchishti9092 Před 4 lety +2

    Amazing video, such a clear and easy explanation. It's apparent from your content that not only do you know what you are talking about but also how to teach!! I have watched a couple other videos for this same problem and no one was able to simplify as you did.

  • @notyet5009
    @notyet5009 Před 2 lety +1

    I wanted the code in C++ but the presentation he nailed it 🔥🔥

  • @crankyinmv
    @crankyinmv Před 4 lety +2

    Thanks for that. I was considering the bitmask solution, but was concerned that no limit was shown for the size of nums.

  • @arunprasad017
    @arunprasad017 Před 4 lety +2

    Thanks for explaining the algorithmic representation before the code. That helped to simplify the recursive solution

  • @heyrmi
    @heyrmi Před 3 lety +3

    This explanation is so clear.

  • @2865285
    @2865285 Před 4 měsíci

    Thank you so much Sir, this explanation was the best!!

  • @fardeendingankar7318
    @fardeendingankar7318 Před 2 lety +1

    can you share phyton code please for recursive solution?

  • @vibhu613
    @vibhu613 Před 2 lety +2

    great.........

  • @saurabhgupta4082
    @saurabhgupta4082 Před 4 lety +2

    sir i love the way you explain.sir can you please make video on kth largest sum of contigous subarray

  • @Mr_SSK
    @Mr_SSK Před 2 lety

    Wow! amazing explanation...
    Thank you so much! :)

  • @vananhtha8241
    @vananhtha8241 Před měsícem

    thanks, amazing video

  • @nischalgandigesuresha2367
    @nischalgandigesuresha2367 Před 11 měsíci

    Nice explanation!

  • @lisajiang9400
    @lisajiang9400 Před rokem

    thanks so much this is the only solution that i understood

  • @pratyushranjansahu9495
    @pratyushranjansahu9495 Před 4 lety +2

    Thanks for the video.

  • @shyamprakashm6325
    @shyamprakashm6325 Před 4 lety +2

    Thank you sir thanks a lot ☺☺🙂

  • @srikanthracharla420
    @srikanthracharla420 Před 2 lety +2

    If possible please add timestamps 🙄, for recursive, and iteration etc.

  • @abdullahzaidan7394
    @abdullahzaidan7394 Před 4 lety +2

    thank u sir ...great explaination
    i am new to python , pls tell me at 26:41 how u concatenated lists

    • @KnowledgeCenter
      @KnowledgeCenter  Před 4 lety +3

      In Python you can concatenate 2 lists with + .
      e.g., list1 = ["x", 5, "z"]
      list2 = [1, 2, 3]
      list3 = list1 + list2 # list3 is ['x', 5, 'z', 1, 2, 3]

    • @KnowledgeCenter
      @KnowledgeCenter  Před 4 lety +2

      AB De villiers. You stopped playing Cricket, and started doing Coding?

    • @abdullahzaidan7394
      @abdullahzaidan7394 Před 4 lety +2

      @@KnowledgeCenter 😂😂 bht scope h coding me Sir

  • @johnsagar5305
    @johnsagar5305 Před 3 lety +2

    Superb solution sir❤️

  • @AmiMish0909
    @AmiMish0909 Před 3 lety

    Good job

  • @gokulnaathb2627
    @gokulnaathb2627 Před 3 lety +2

    Thank you, Sir :)

  • @anmolyadav7637
    @anmolyadav7637 Před 2 lety +1

    anyone getting memory limit exceeded error?