Generate All Possible Subsets | Return Power Set | Leetcode 78. | Bit Manipulation | Two for loops

Sdílet
Vložit
  • čas přidán 13. 02. 2022
  • Given an integer array nums of unique elements, return all possible subsets (the power set).
    The solution set must not contain duplicate subsets. Return the solution in any order.
    Example 1:
    Input: nums = [1,2,3]
    Output: [[],[1],[2],[1,2],[3],[1,3],[2,3],[1,2,3]]
    Example 2:
    Input: nums = [0]
    Output: [[],[0]]
    Connect with me on LinkedIn : / alisha-parveen-80579850
    Check out our other playlists:
    Dynamic Programming:
    • Dynamic Programming
    Trees:
    • Trees
    Heaps and Maps:
    • Heaps and Maps
    Arrays and Maths:
    • Arrays and Maths
    Bit Manipulation:
    • Bit Manipulation
    Greedy Algorithms:
    • Greedy Algorithms
    Sorting and Searching:
    • Sorting and Searching
    Strings:
    • Strings
    Linked Lists:
    • Linked Lists
    Stack and Queues:
    • Stacks and Queues
    Two Pointers:
    • Two pointers
    Graphs, BFS, DFS:
    • Graphs, DFS, BFS
    Backtracking:
    • Backtracking
    Non- DSA playlists:
    Probability:
    • Probability
    SQL-Basic Join functions:
    • SQL - Basic JOIN Funct...
    SQL-Basic Aggregate functions:
    • SQL-Basic Aggregate Fu...

Komentáře • 48

  • @probabilitycodingisfunis1

    Time Complexity : O(N*2^(N))
    int n = nums.size(); // n=3 -> 2^3 = 8

    for(int i=0;i

    • @joelduran9344
      @joelduran9344 Před rokem

      How can this be written in Java?

    • @eyadhantoly5796
      @eyadhantoly5796 Před rokem

      @@joelduran9344
      import java.util.*;
      public class Main {
      public static void main(String[] args) {
      int []input = {1, 2, 3};
      ArrayList arrayList;
      ArrayList solution = new ArrayList();
      for (int i = 0; i

  • @jonlombardi1216
    @jonlombardi1216 Před 7 dny

    I appreciate your speed personally, thank you for making an informative video with clear examples as you went step by step.

  • @Codro09
    @Codro09 Před 2 měsíci +2

    I saw 2-3 videos before and I didnt understand their solution but as you started to explain the code I coded myself.
    Thanks maam for your solution.

  • @sanketdatta9874
    @sanketdatta9874 Před 25 dny

    Thanks. Really nice and detailed explanation

  • @satyamgupta6030
    @satyamgupta6030 Před rokem +1

    I solved it by my own just came here to see ur solution and I again learnt something new thanks alisha I only prefer ur videos.

  • @devangrathod6763
    @devangrathod6763 Před měsícem +1

    Finally found a better explanation and solution, thanks @code with Alisha

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

    very well explained,👏 today i learnt a new approach of this question.

  • @aviral1430
    @aviral1430 Před rokem +6

    Ma'am wouldn't it be better if we initialise the vector as
    vectorv = { };
    since there won't be any garbage value in it

  • @111rhishishranjan2
    @111rhishishranjan2 Před rokem

    Great , finally found subset using power set

  • @mayursoni2838
    @mayursoni2838 Před měsícem +1

    I just see your linkedin you are graduated from IIT BOMBAY ............Wow

  • @girlprogrammer3263
    @girlprogrammer3263 Před rokem

    Well explained. Thank You

  • @KomalKanwarRathore-oy3yv

    thanks for the video it very clear explanation🙂

  • @sanskarkumar7285
    @sanskarkumar7285 Před rokem

    very clear explanation. thank you didi.

  • @Rakshit_Jain
    @Rakshit_Jain Před rokem +2

    can't be better than this!👍

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

    NICE SUPER EXCELLENT MOTIVATED

  • @kaustubhsonar4613
    @kaustubhsonar4613 Před 3 měsíci

    I spend 1 hr behind this problem made the spaghetti of it
    And code here to see this
    Well this is new approach to me
    Thanks teacher

  • @UECMadhurendraKumar
    @UECMadhurendraKumar Před 5 měsíci +1

    Nice explanation

  • @AmanSharma-vb5jl
    @AmanSharma-vb5jl Před 2 lety +1

    back with a bang!

  • @TON-108
    @TON-108 Před rokem +1

    Thank you, very well explained

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

    thanku

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

    hi alisha it would be more easy to understand if you dry run your code on wb and then explain

  • @starbawa5587
    @starbawa5587 Před rokem

    Good solution

  • @user13443fg
    @user13443fg Před 2 měsíci

    Very helpful

  • @HARSHRAJ-wz2rp
    @HARSHRAJ-wz2rp Před 8 měsíci

    thank you mam

  • @Idukhan-jj9kc
    @Idukhan-jj9kc Před 2 lety

    💯💯

  • @jayeshchaurasiya262
    @jayeshchaurasiya262 Před rokem

    Love you mam ❤️

  • @rajasharma4598
    @rajasharma4598 Před rokem

    W for explainng

  • @sourabhh_garg
    @sourabhh_garg Před 7 měsíci

    Thanku didi

  • @RAMKUMAR-eb1kq
    @RAMKUMAR-eb1kq Před rokem

    mam can you explain how decimal been converted to bits in c++;

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

    Great explanation but theres a small correction at 06:50 for i = 3 (011) you are going to take [2, 3]

  • @rahulchoudhary7903
    @rahulchoudhary7903 Před rokem +4

    ma'am how "i" number is converted to binary number

  • @prakhaxr
    @prakhaxr Před rokem

    Hoshiyar aunty !!

  • @sunshineandrainbow5453
    @sunshineandrainbow5453 Před 5 měsíci

    Very helpful di. Thanks a lot. Just a small doubt about how (1

  • @meandpenguinvlogs8221
    @meandpenguinvlogs8221 Před 2 lety

    Udeserb more and more subscribers 👍👍

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

    Hi alisha

  • @Um3n14
    @Um3n14 Před 2 lety

    the grid above is a 3*5 grid. This grid has four infected patients at position (0,0), (0,3), (1,3) and (2,3). Patient at (0,0) will most likely infect recovering patient at (1,0) and (0,1), infected patient (0,3) will most likely infect recovering patient (0.4), infected patient (1,3) will infect both recovering patient at (1,2) and (1,4). And lastly, infected patient (2,3) will infect recovering patient (2,4). Total number of recovering patients infect is 6. For the first round of infection, one unit of time will be recorded. For the second round of infection, recovering patient (2,0) will be infected by patient (1,0). Patient (1,0) was infected in the first round. Only one patient is infected in the second round. Total amount of time taken for the whole area to be infected is 2.
    What is the algorthm can we use?

    • @Um3n14
      @Um3n14 Před 2 lety

      it is M*N miss can you help me with this problem?

  • @mdalishanali3909
    @mdalishanali3909 Před 2 lety

    great same name just n is not there

  • @ayushtiwari3819
    @ayushtiwari3819 Před 11 měsíci +2

    very sloppy presentation to be honest. You take it slow, write down things properly. I get the gist but still.

  • @avrilnigelchua
    @avrilnigelchua Před 9 měsíci

    THANK YOU! 🥲🥲😇