Skip to content

Commit 8e14430

Browse files
authored
Update Missing-Number.py
1 parent 034d3a7 commit 8e14430

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Leetcode/Missing-Number.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,20 @@ def missingNumber(self, nums: List[int]) -> int:
3131
3232
return total_seq_xor ^ current_num_xor
3333
"""
34-
34+
35+
36+
"""
37+
current_sum = 0
38+
max_sum = 0
39+
40+
for i in range(0, len(nums) + 1):
41+
max_sum += i
42+
43+
for i in nums:
44+
current_sum += i
45+
46+
return max_sum - current_sum
47+
"""
3548

3649

3750

0 commit comments

Comments
 (0)