78. Subsets
Alg1: DFS.
Alg2: For each node there is only two choice, include or exclude. Build all the powerset sumoutenously using list comprehension.
Given a set of distinct integers, nums, return all possible subsets (the power set).
Note: The solution set must not contain duplicate subsets.
Example:
1 | Input: nums = [1,2,3] |
Soulution:
1 | # Alg1 |
1 | # Alg2 |