Generate All Possible Subsets | Return Power Set | Leetcode 78. | Bit Manipulation | Two for loops
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...
Time Complexity : O(N*2^(N))
int n = nums.size(); // n=3 -> 2^3 = 8
for(int i=0;i
How can this be written in Java?
@@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
I appreciate your speed personally, thank you for making an informative video with clear examples as you went step by step.
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.
Thanks. Really nice and detailed explanation
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.
Finally found a better explanation and solution, thanks @code with Alisha
very well explained,👏 today i learnt a new approach of this question.
Ma'am wouldn't it be better if we initialise the vector as
vectorv = { };
since there won't be any garbage value in it
Great , finally found subset using power set
I just see your linkedin you are graduated from IIT BOMBAY ............Wow
Well explained. Thank You
thanks for the video it very clear explanation🙂
very clear explanation. thank you didi.
can't be better than this!👍
NICE SUPER EXCELLENT MOTIVATED
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
Nice explanation
back with a bang!
Thank you, very well explained
thanku
hi alisha it would be more easy to understand if you dry run your code on wb and then explain
Good solution
Very helpful
thank you mam
💯💯
Love you mam ❤️
W for explainng
Thanku didi
mam can you explain how decimal been converted to bits in c++;
Great explanation but theres a small correction at 06:50 for i = 3 (011) you are going to take [2, 3]
no
ma'am how "i" number is converted to binary number
same doubt i too had
Hoshiyar aunty !!
Very helpful di. Thanks a lot. Just a small doubt about how (1
while doing (1
@@shreyash_17_ thanks
Udeserb more and more subscribers 👍👍
Hi alisha
🤣
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?
it is M*N miss can you help me with this problem?
great same name just n is not there
very sloppy presentation to be honest. You take it slow, write down things properly. I get the gist but still.
THANK YOU! 🥲🥲😇