public class Solution {
public int missingNumber(int[] nums) {
int check = 0;
for (int i=0; i<nums.length; i++) {
check ^= nums[i] ^ i+1;
}
return check;
}
}

Very smart answer! If there are no missing. There are equivalent sets of numbers in array values and array indexes. So if we XOR all of them, the result should be 0. Now as there's a missing one, the XOR result will be the missing one.