268. Missing Number
202401211602
tags: #bit-manipulation
class Solution(object):
def missingNumber(self, nums):
n = len(nums)
sum = (n * (n + 1)) // 2
for num in nums:
sum -= num
return sum
202401211602
tags: #bit-manipulation
class Solution(object):
def missingNumber(self, nums):
n = len(nums)
sum = (n * (n + 1)) // 2
for num in nums:
sum -= num
return sum