leetcode--46. 全排列

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Hilavergil/article/details/80054445

题目:46. 全排列

链接:https://leetcode-cn.com/problems/permutations/description/

给定一个list(无重复元素),返回其全排列。

python:

import itertools
class Solution:
    def permute(self, nums):
        """
        :type nums: List[int]
        :rtype: List[List[int]]
        """
        return list(itertools.permutations(nums))
其他没有这个函数的深搜就行吧。

猜你喜欢

转载自blog.csdn.net/Hilavergil/article/details/80054445