题目描述
blablabla
样例
class Solution(object):
def getNumberSameAsIndex(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if not nums or len(nums) == 0:
return -1
left, right = 0, len(nums) - 1
while left < right:
mid = left + right >> 1
if nums[mid] < mid:
left = mid + 1
else:
right = mid
if nums[right] == right:
return nums[right]
else:
return -1