Java 代码
class Solution
{
public int getMissingNumber(int[] nums)
{
if (nums.length == 0)
return 0;
int x = -1;
for (int i = 0; i < nums.length; i ++)
{
if (nums[i] != i)
{
x = i;
break;
}
}
if (x == -1)
return nums.length;
else
return x;
}
}