Leetcode 78 - Subsets

이두현·2021년 12월 28일
0

Leetcode 78

Subsets

언어: python3

class Solution:
    def subsets(self, nums: List[int]) -> List[List[int]]:
        length = len(nums)
        result = []
        for i in range(length+1):
            temp = list(itertools.combinations(nums,i))
            print(temp)
            result += list(map(list,temp))
            print(result)
            
        return result

using built-in libraries

profile
0100101

1개의 댓글

comment-user-thumbnail
2022년 1월 3일

I found that solution is very popular and helpful: https://youtu.be/NS01_5oZn7c

답글 달기