```
class Solution {
public:
// if only one number missing, just use n(n+1)/2 - sum_now
int missingNumber(vector<int>& nums) {
int sum = (nums.size()+1)*(0+nums.size())/2;
int sum2 = 0,i=0;
while(i < nums.size())
sum2 += nums[i++];
return sum-sum2;
}
};
```