Skip to content

Commit 1dcc928

Browse files
committed
Time: 152 ms (39.76%), Space: 17.7 MB (81.86%) - LeetHub
1 parent e8ef9d6 commit 1dcc928

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class Solution:
2+
def missingNumber(self, nums: List[int]) -> int:
3+
xor1=0
4+
xor2=0
5+
n=len(nums)
6+
for i in range(n):
7+
xor1^=nums[i]
8+
xor2^=i+1
9+
return xor1^xor2

0 commit comments

Comments
 (0)