1064. Fixed Point
On This Page
class Solution:
def fixedPoint(self, arr: List[int]) -> int:
left, right = 0, len(arr) - 1
while left < right:
mid = (left + right) >> 1
if arr[mid] >= mid:
right = mid
else:
left = mid + 1
return left if arr[left] == left else -1