Clean python code


  • 0
    class Solution(object):
        def permuteUnique(self, nums):
            record, r = set(), []
    
            for i, num in enumerate(nums):
                if num not in record:
                    record.add(num)
                    r += [
                        [num] + path
                        for path in self.permuteUnique(
                            nums[:i] + nums[i + 1:]
                        ) or [[]]
                    ]
    
            return r
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.