排序数组中的搜索问题,首先想到 二分法
class Solution: def missingNumber(self, nums: List[int]) -> int: i, j = 0, len(nums)-1 while i <= j: m = (i+j)//2 if nums[m] == m: # 数组的值等于索引值 i= m+1 else: j = m-1 return i