NeetCode #272LC-540MediumBinary Search
← Back to All Problems

#272 · #540 · Single Element in a Sorted Array(有序数组中的单一元素)

📌 Problem Statement & Constraints

You are given a sorted array of integers where every element appears exactly twice except one element which appears once. Return the single element. Constraints: 1 <= nums.length <= 10^5, nums.length is odd, 0 <= nums[i] <= 10^5. The solution must run in O(log n) time and O(1) space.
🔒

Sign In to Unlock Full Solutions for All 973 Problems

Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!