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).

def findDuplicate(self, nums): result=0 for i in nums: if result&(1<<i):return i result+=(1<<i)

is that really using O(1) space? from your answer ,i think u use a bit to indicate a num from nums, but a byte only have 8bits so you may need o(n/32) = o(n) space??

yes, in python, a int is very very big. But you are right, it is O(n)

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