We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 47a9791 commit 2f4819cCopy full SHA for 2f4819c
1 file changed
LeetCode/0078. Subsets/solution.py
@@ -0,0 +1,16 @@
1
+"""
2
+10 / 10 test cases passed.
3
+Runtime: 52 ms
4
+Memory Usage: 15.1 MB
5
6
+class Solution:
7
+ def subsets(self, nums: List[int]) -> List[List[int]]:
8
+ ans, path = [], []
9
+ def backtrack(start, path):
10
+ ans.append(path[:])
11
+ for i in range(start, len(nums)):
12
+ path.append(nums[i])
13
+ backtrack(i + 1, path)
14
+ path.pop();
15
+ backtrack(0, path)
16
+ return ans
0 commit comments