text: // All the subsets
  // A big advantage of bit manipulation is that it is trivial to iterate over all the subsets of an N-element set: every N-bit value represents some subset. Even better, if A is a subset of B then the number representing A is less than that representing B, which is convenient for some dynamic programming solutions.
  
  // It is also possible to iterate over all the subsets of a particular subset (represented by a bit pattern), provided that you don’t mind visiting them in reverse order (if this is problematic, put them in a list as they’re generated, then walk the list backwards). The trick is similar to that for finding the lowest bit in a number. If we subtract 1 from a subset, then the lowest set element is cleared, and every lower element is set. However, we only want to set those lower elements that are in the superset. So the iteration step is just i = (i - 1) & superset.
  
  vector<vector<int>> subsets(vector<int>& nums) {
      vector<vector<int>> vv;
      int size = nums.size(); 
      if(size == 0) return vv;
      int num = 1 << size;
      vv.resize(num);
      for(int i = 0; i < num; ++i) {
          for(int j = 0; j < size; ++j)
              if((1<<j) & i) vv[i].push_back(nums[j]);   
      }
      return vv;
  }
  // Actually there are two more methods to handle this using recursion and iteration respectively.