266. Power Set Bit Manipulation

Given an array of integers nums of unique elements. Return all possible subsets (power set) of the array.

Do not include the duplicates in the answer.

Example 1:

Input : nums = [1, 2, 3]

Output : [ [ ] , [1] , [2] , [1, 2] , [3] , [1, 3] , [2, 3] , [1, 2 ,3] ]

Example 2:

Input : nums = [1, 2]

Output : [ [ ] , [1] , [2] , [1, 2] ]

Now Your Turn!

Pick the correct output for the given input

Input : nums = [0]

Still unsure what the problem is asking ?

Let’s go through a few more examples, step by step, to make it clearer.

Constraints:

  • 1 <= nums.length <= 10
  • -10 <= nums[i] <= 10

Hints

Frequently Occurring Doubts

Interview Follow-up Questions

Fun Facts

0
class Solution {
public:
vector<vector<int> > powerSet(vector<int>& nums) {
//your code goes here
}
};
Test Case

Input:

Nums