```
int missingNumber(vector<int>& nums) {
int len=nums.size();
int sum=0;
for(int i =0 ; i< len ; i++)
sum+=nums[i];
int t = (len*(len+1))/2;
return t-sum;
}
```

We can use the property of sum of n natural numbers .. (n*(n+1))/2 ..