Missing Number

Given an array of n distinct numbers in the range [0, n], the task is to find the single missing number from the array.

Constraints

  • n == nums.length
  • 1 <= n <= 10000
  • 0 <= nums[i] <= n
  • All numbers of nums are unique.
Auto-saved · 2 lines
class Solution:
def findMissingNumber(self, nums) -> int:
Console

Click Run to execute sample tests.