Given an integer array nums of distinct elements, return all possible subsets (the power set). Pattern focus: Bitmask Enumeration. Each subset corresponds to one bitmask from 0 to 2^n - 1.
nums = distinct integers
all subsets of nums
Example 1:
Input:
nums = [1,2,3]
Output:
[[],[1],[2],[1,2],[3],[1,3],[2,3],[1,2,3]]
Explanation:
Every bitmask from 000 to 111 maps to one subset.
Example 2:
Input:
nums = [0]
Output:
[[],[0]]
Explanation:
There are two subsets: empty set and the single-element set.