LeetCode 46. Permutations

Doyeon Kim·2022년 3월 17일

코딩테스트 공부

목록 보기
35/171

문제 링크 : https://leetcode.com/problems/permutations/


해설쓰는것도 조금 민망할만큼 쉬운 문제이다...

class Solution:
    def permute(self, nums: List[int]) -> List[List[int]]:
        from itertools import permutations
        return list(permutations(nums, len(nums)))

파이썬 내부의 permutations를 이용하면 쉽게 풀 수 있다.

아마 내부 함수를 활용하지 않고 for문을 이용하여 직접 조합하는 방법도 있을것이다.....

profile
성장하고 도전하는 개발자. 프로그래밍 좋아하세요?

0개의 댓글