When I ran my test I failed because  didn't return 1 so I updated my code to increment the value by 1 and return it if only 1 element is in the array. Then I submit and it says  should return 0 instead of 2...
See, it is an array that starts at 0, and has n elements, and there's always one element missing, so the complete array should have n+1 element.
Therefore input , one element missing, it must be 1, but if you input , the array should start at 0 but there is no 0, so 0 must be the missing element.
Does this make sense?