Here's the complete bitmask solution:
function subsets(nums)
n := length of nums
total := 2^n
result := []
for mask from 0 to total - 1
subset := []
for i from 0 to n - 1
if (mask & (1 << i)) ≠ 0 then
append nums[i] to subset
append subset to result
return result
Outer loop generates all masks. Inner loop builds each subset by checking which bits are set. Time: (for each of masks, you check bits). Space: for the output.