IT_World
[leetcode]78. Subsets 본문
class Solution:
def subsets(self, nums: List[int]) -> List[List[int]]:
result = []
def dfs(index,path) :
result.append(path)
for i in range(index, len(nums)):
dfs(i + 1,path + [nums[i]])
dfs(0,[])
return result
'Coding test > programmers - single' 카테고리의 다른 글
[leetcode] 39. Combination Sum (0) | 2022.04.01 |
---|---|
[leetcode]77. Combinations (0) | 2022.03.31 |
[leetcode] 22. Generate Parentheses (0) | 2022.03.29 |
[leetcode] 67. Add Binary (0) | 2022.03.27 |
[leetcode] 53. Maximum Subarray (0) | 2022.03.26 |
Comments