```
public class Solution {
public int missingNumber(int[] nums) {
int nindex=-1;
int n = nums.length;
for(int i=0;i<n;i++)
{
while(nums[i]!=i&&nums[i]!=n)
{
int tmp = nums[i];
nums[i] = nums[nums[i]];
nums[tmp] = tmp;
}
if(nums[i]==n)
nindex=i;
}
return nindex==-1?n:nindex;
}
```

}