@sachinvarma9949

never thought this problem can be solved by this approach

@GopalGangoriya

00:04 Printing all subsets using power set technique
01:37 Power set is the number of subsets
03:16 Using simple Boolean logic to generate power set
04:54 Creating subsets using bit manipulation
06:27 Iterate and generate subsets using bit manipulation.
07:59 Generating power set using bit manipulation
09:34 Generating power set using bit manipulation.
11:14 Discussing space complexity and subset sizes in power set generation.

@arnabnath4782

No one can explain this with that ease..wonderful πŸ‘πŸΌπŸ‘πŸΌπŸ‘πŸΌπŸ‘πŸΌ

@santoshkumak

This problem looks very easy from explanation but after he writes code and mapping back to explanation you will know how tricky it is....
Kudos to you for putting this explanation and solution....

@rajdeep3493

watched it 3-4 times then i get the solution 
thanks man for explaining so nicely

@vishnupandey3390

nums=[1,2,3]
length=len(nums)
upper=(2**length)-1
sup_set=list()
for i in range(upper,-1,-1):
    ans=list()
    for j in range(length):
        mask=1<<j
        if i&mask : ans.append(nums[j]) 

    sup_set.append(ans)
print(sup_set)

@AbhishekSharma-26

c++ code 
class Solution {
public:
    vector<vector<int>> subsets(vector<int>& nums) {
         int n = nums.size();
        int subsett = 1 << n;
        vector<vector<int>> ans;
        for(int num = 0; num < subsett; num++) {
            vector<int> list;
            for(int i = 0; i < n; i++) {
                if(num & (1 << i)) {
                    list.push_back(nums[i]);
                }
            }
            ans.push_back(list);
        }
        return ans;
    }
};

@nishchaypandit973

Brother i have my placement in 3 months plz continue this playlist

@ssh3v

the observation that take set bit  of 2^n index in input array  as member of a subset is very theoretical & observation intensive   and hard to come up with , if we have seen never before, how to deal with it @take U forward

@sarder681

striver its really deep knowledge .its hard to understand but code is simple and couple of lines.However understood boss.

@Nikhil-xx5bh

Take a bow 🏹 what an explanation 6:16

@dharanyuvi6951

Love this problem and the way of solving it

@unoshihaam

public static void main(String[] args) {
        int[] nums = {1,2,3};
        int subsets = 1<<nums.length;
        ArrayList<ArrayList<Integer>> al = new ArrayList<>();
        for(int i=0;i<subsets;i++){
            ArrayList<Integer> subal = new ArrayList<>();
            for(int j=0;j<nums.length;j++){
                if((i&(1<<j))!=0){
                    subal.add(nums[j]);
                }
            }
            al.add(subal);
        }
        System.out.println(al);

@jagadeesh6199

broo, i came after that recursion playlist only, there you are telling to watch bit manipulation playlist and here you are telling to watch recursion playlistπŸ€­πŸ€­πŸ˜‚πŸ€£, btw you are the best thooo

@raghavmanish24

mjhe to khud pe pura beleive hai ki kv na soch pata mai ye .....mind blowing solution......thanku striver

@Tejs_45

I got the solution that how ur getting the subsequence but how is that final list ur storing in ans ? What data struc is that ans

@Cric_trick572

If(nums & (1<<i)) kounsa logic lga hai?

@lshuarckyma

the space complexity will be O(2^n) as 2^n is the sum of all the lengths of all the temp lists that will be created

@stith_pragya

Understood.....Thank You So Much for this wonderful video............πŸ™πŸ»πŸ™πŸ»πŸ™πŸ»πŸ™πŸ»πŸ™πŸ»πŸ™πŸ»

@ritwikdutta6914

int n = nums.length;
        List<List<Integer>> ans = new ArrayList<>();
        for(int i = 0; i < (1 << n); i++){
            int num = i;
            ArrayList<Integer> ls = new ArrayList<>();
            int j = 0;
            while(num > 0){
                if((num & 1) == 1)
                   ls.add(nums[j]);

                j++;
                num = num >> 1;
            }

            ans.add(ls);
        }

        return ans;

i did like this. In Java