class Solution {
public:
int getMissingNumber(vector<int>& nums) {
//左边满足性质nums[i] == i,右边不满足,故而可以考虑二分
if(nums.empty()) return 0;
int l = 0,r = nums.size() - 1;
while(l < r){
int mid = l + r >> 1;
if(nums[mid] != mid) r = mid;
else l = mid + 1;
}
if(nums[r] == r) r++;
return r;
}
};