Skip to content

Commit 2f4819c

Browse files
committed
✨ upload T78 python solution
1 parent 47a9791 commit 2f4819c

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

LeetCode/0078. Subsets/solution.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)