题目
解答
public void testMissingNumber(){
int[] nums = {9,6,4,2,3,5,7,0,1};
System.out.println(missingNumber(nums));
}
private int missingNumber(int[] nums){
Arrays.sort(nums);
for(int i = 0;i<nums.length;i++){
if(i!=nums[i]) return i;
}
return nums.length;
}