Logo
IconChallenge
Icon
IconProblem
IconSolutions
IconSubmissions

Missing Number

XPChallenge Points: 10
levelLevel: Easy

You are given an array nums that contains n distinct integers in the range [0, n].
The array represents a sequence of unique numbers, but exactly one number is missing from the full range.

Your task is to find and return the missing number.

Example 1:

Input: nums = [4, 2, 1, 0]

Output: 3

Example 2:

Input: nums = [1, 2, 3, 4]

Output: 0

Example 3:

Input: nums = [5, 3, 0, 1, 4]

Output: 2

to Continue
like
dislike

Accepted:

Submission:

IconReport an issue
Icon
IconCode
IconYou need toto run or submitYou need toto run or submit
IconTest Case
IconTest Result