class Solution:
def singleNonDuplicate(self, nums: List[int]) -> int:
low, high = 0, len(nums) - 1
while low < high:
mid = (low + high) // 2
if nums[mid] == nums[mid ^ 1]:
low = mid + 1
else:
high = mid
return nums[low]
Leetcode-540 有序数组中的单一元素
最新推荐文章于 2024-11-05 21:58:11 发布
关键词由CSDN通过智能技术生成