class Solution {
public:
int missingNumber(vector<int>& nums) {
int n = nums.size() + 1;
int l = 0, r = n - 1;
while (l < r) {
int mid = l + r >> 1;
if (nums[mid] > mid) r = mid;
else l = mid + 1;
}
return l;
}
};