Python 1 line


  • 0
    D

    Using sets

    class Solution(object):
        def findDisappearedNumbers(self, nums):
            return list(set(nums) ^ set([x for x in range(1,len(nums)+1)]))
    

Log in to reply
 

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