78. Subsets

Practice Subsets for free on NudgeCode: Medium, Backtracking pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.

nums holds distinct integers. Return every subset of it (the power set), including the empty set, with no duplicate subsets. The subsets, and the values inside each, can be in any order.

Example

nums = [1,2,3]  ->  [[],[1],[2],[1,2],[3],[1,3],[2,3],[1,2,3]]

Constraints