nums holds different values. Return every subset (including the empty one and the whole list). Write each subset in increasing order, and list the subsets in dictionary order (compare the first value, then the second, and so on; a shorter list that is the start of a longer one comes first).
For [1, 2, 3] that is [], [1], [1, 2], [1, 2, 3], [1, 3], [2], [2, 3], [3].
Example 1
Input:
all_subsets([1, 2, 3])
Output:
[[], [1], [1, 2], [1, 2, 3], [1, 3], [2], [2, 3], [3]]
Example 2
Input:
all_subsets([])
Output:
[[]]
0 <= len(nums) <= 14-100 <= nums[i] <= 100No results yet
Run your code to check it against the examples, or submit to run every test.