Tap here to switch tabs
Problem
Ask
Submissions

Problem: Missing Number

easy
15 min
Explore how to solve the missing number problem in an array of distinct numbers using cyclic sort. Understand the problem constraints and implement your solution efficiently. This lesson helps you apply a key coding pattern for technical interviews.

Statement

Given an array, nums, containing nn distinct numbers in the range [0,n][0, n], return the only number in the range that is missing from the array.

Constraints:

  • n=n = nums.length
  • 1n1031 \leq n \leq 10^3
  • 00 \leq nums[i] n\leq n
  • There are no duplicates in the array.
Tap here to switch tabs
Problem
Ask
Submissions

Problem: Missing Number

easy
15 min
Explore how to solve the missing number problem in an array of distinct numbers using cyclic sort. Understand the problem constraints and implement your solution efficiently. This lesson helps you apply a key coding pattern for technical interviews.

Statement

Given an array, nums, containing nn distinct numbers in the range [0,n][0, n], return the only number in the range that is missing from the array.

Constraints:

  • n=n = nums.length
  • 1n1031 \leq n \leq 10^3
  • 00 \leq nums[i] n\leq n
  • There are no duplicates in the array.