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