2018-12-04 leetcode Find All Numbers Disappeared in an Array Find All Numbers Disappeared in an ArrayOne line Version - 152ms 1234567class Solution: def findDisappearedNumbers(self, nums): """ :type nums: List[int] :rtype: List[int] """ return list(set(range(1, len(nums) + 1)) - set(nums)) Without Extra Space Version - 224ms 123456789101112class Solution: def findDisappearedNumbers(self, nums): """ :type nums: List[int] :rtype: List[int] """ for i in range(len(nums)): idx = abs(nums[i]) - 1 nums[idx] = - abs(nums[idx]) #print(i, idx, nums) return [i + 1 for i in range(len(nums)) if nums[i] > 0] test code 12In [31]: s = Solution(); t = s.findDisappearedNumbers([4,3,2,7,8,2,3,1]); print(t)[5, 6] leet code Newer Convert BST to Greater Tree Older Palindromic Substrings