Python - Find All Numbers Disappeared in an Array - 232 ms


  • 0
    P

    It's my solution to the problem Find All Numbers Disappeared in an Array in Python.

    class Solution(object):
        def findDisappearedNumbers(self, nums):
            """
            :type nums: List[int]
            :rtype: List[int]
            """
            maximum = len(nums) + 1
            refactored = set(nums) 
            if (len(nums) != 0):
                aux = range(1,maximum)
                return list(set(aux) - refactored)
            return []
    

    Time to execute, 232 ms. I hope that it can help to someone!


Log in to reply
 

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