Solution: Missing Number
Explore how to solve the Missing Number problem by sorting the array in-place with cyclic sort. Understand how to identify the first index where the element does not match the index to find the missing value efficiently in linear time and constant space.
Statement
Given an array, nums, containing distinct numbers in the range , return the only number in the range that is missing from the array.
Constraints:
-
nums.length