Skip to content

Commit f731b46

Browse files
committed
Create P111. 丢失的数字.md
1 parent 482fd0f commit f731b46

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

P111. 丢失的数字.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
***给定一个包含 [0, n] 中 n 个数的数组 nums ,找出 [0, n] 这个范围内没有出现在数组中的那个数。***
2+
3+
```
4+
class Solution(object):
5+
def missingNumber(self, nums):
6+
"""
7+
:type nums: List[int]
8+
:rtype: int
9+
"""
10+
missing = len(nums)
11+
12+
for ind, num in enumerate(nums):
13+
missing ^= ind^num
14+
return missing
15+
```

0 commit comments

Comments
 (0)