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.

&nbsp;
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]]


&nbsp;
Constraints:


	1 &lt;= nums.length &lt;= 10
	-10 &lt;= nums[i] &lt;= 10
	All the numbers of&nbsp;nums are unique.


class Solution:
    def subsets(self, nums: List[int]) -> List[List[int]]:
        self.final_list = []
        def subset(final_list,curr_list,listt,i):
            if i == len(listt):
                final_list.append(curr_list)
                return
            else:
                subset(final_list,curr_list,listt,i+1)
                subset(final_list,curr_list+[listt[i]],listt,i+1)
        subset(self.final_list,[],nums,0)
        return self.final_list
class Solution {
    
    private static void solve(int[] nums, int i, List<Integer> temp, List<List<Integer>> subset){
        
        if(i == nums.length){
            subset.add(new ArrayList(temp));
            return;
        }
        
        temp.add(nums[i]);
        solve(nums, i + 1, temp, subset);
        
        temp.remove(temp.size() - 1);
        solve(nums, i + 1, temp, subset);
    }
    
    public List<List<Integer>> subsets(int[] nums) {
        List<List<Integer>> subset = new ArrayList();
        List<Integer> temp = new ArrayList<>();
        
        if(nums.length == 0) return subset;

        int startInd = 0;
        
        solve(nums, startInd, temp, subset);
            
        return subset;
    }
}
class Solution {
   void subsetGenerator (vector<int> nums, int n, vector<vector<int>> &ans, int i, vector<int> subset)
   {
                                                  
        if(i>=n)    //Base Case
		{        
            ans.push_back(subset);  //the subset obatined is pushed into ans
            return ;
        }
        //including the element at index i and then calling the recursive function
         subset.push_back(nums[i]);
         solve(nums,n,ans,i+1,subset);
        
		
         //excluding the element at index i and then calling the recursive function
         subset.pop_back();
         solve(nums,n,ans,i+1,subset);
              
    }
public:

    vector<vector<int>> subsets(vector<int>& nums) {
	    int i=0;                  // index is initialized to 0 as we start from the first element
        int n=nums.size();        // size of the vector nums
		vector<int> subset;       // this vector will store each subset which is generated
        vector<vector<int>> ans;  // will store all the subsets generated
        
        subsetGenerator(nums, n, ans, i, subset);
	
        return ans;
    }
};
var subsets = function(nums) {
    
    const res = [];
    
    const dfs = (i, slate) => {
        
        if(i == nums.length){
            
            res.push(slate.slice());
            
            return;
            
        }
        
		// take the current number into the subset.
        slate.push(nums[i]);
        dfs(i + 1, slate);
        slate.pop();
        
		// ignore the current number.
        dfs(i + 1, slate);  
        
    }
    
    dfs(0, []);
    
    return res;
    
};
Subsets