The question says
Given an array containing n distinct numbers taken from 0, 1, 2, ...,
n, find the one that is missing from the array.
For example, Given nums = [0, 1, 3] return 2.
So similarly it means if array is of size 4 , it can have numbers from the set 0 , 1, 2 , 3 , 4
In array of length 4 , you have [1,2,3,4] .. So here , missing number from the set is 0 .
Hence, the answer is 0 regardless of whether it can be inserted in the array or not.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.