64. Subsets

nums has distinct integers. Return all possible subsets (the power set), without duplicates, in any order.

Example 1

Input: nums = [1,2,3]
Output: [[],[1],[2],[3],[1,2],[1,3],[2,3],[1,2,3]]

Example 2

Input: nums = [0]
Output: [[],[0]]
Hint 1

Each element is either in or out: 2ⁿ subsets.

Hint 2

Backtracking template: choose, explore, un-choose.

BacktrackingBit Manipulation