Backend Engineer
Senior
programming
You have a sorted array of integers, where each integer appears twice except for one integer which appears only once. Write a function to find that single integer. ### Function Signature ```python def single_number(nums: List[int]) -> int: ``` ### Constraints - `1 <= nums.length <= 10^5` - `0 <= nums[i] <= 10^5` ### Examples 1. Input: `single_number([1, 1, 2, 2, 3])` Output: `3` 2. Input: `single_number([4, 1, 2, 1, 2])` Output: `4`
Suggested Answer