Python many lines


  • 0
    D
    class Solution(object):
        def findDisappearedNumbers(self, nums):
            """
            :type nums: List[int]
            :rtype: List[int]
            """
            res = list(range(1, len(nums) +1))
            for x in nums:
              i = x - 1
              res[i] = -1
            return list(filter(lambda x: x != -1, res))
    

Log in to reply
 

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