diff --git a/Python/78-Subsets.py b/Python/78-Subsets.py new file mode 100644 index 0000000..36373e7 --- /dev/null +++ b/Python/78-Subsets.py @@ -0,0 +1,21 @@ +#link to problem:https://leetcode.com/problems/subsets/ + + #code + + class Solution: + def subsets(self, nums: List[int]) -> List[List[int]]: + + res = [] + + + def solve(v = [], ind = 0): + + if ind == len(nums): + res.append(v) + return + + solve(v + [nums[ind]], ind + 1) # pick + solve(v, ind + 1) # non-pick + + solve() + return res