Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.

Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).

I am not sure if this code will use extra space?

class Solution(object): def findDisappearedNumbers(self, nums): """ :type nums: List[int] :rtype: List[int] """ return [i for i in range(1,len(nums)+1) if i not in set(nums)]

It uses O(n) space since you create a set of integers.

And it's not O(n) time but only O(n^{2}) time.

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