Beats 100% || Binary Search || O(log  n)
Explanation:
We perform a binary search to find the single non-duplicate element.
If mid is even:
If nums[mid] == nums[mid + 1], the unique element must be on t
Explanation:
We perform a binary search to find the single non-duplicate element.
If mid is even:
If nums[mid] == nums[mid + 1], the unique element must be on the right, so we move l = mid + 2.
Otherwise, we move r = mid.
If mid is odd:
If nums[mid] == nums[mid - 1], the unique element must be on the right, so we move l = mid + 1.
Otherwise, we move r = mid.
The loop terminates when l == r, and nums[l] is the unique element.
This solution runs in O(log n) time complexity, leveraging binary search.
# Code
```python3 []
from typing import List

class Solution:
    def singleNonDuplicate(self, nums: List[int]) -> int:
        l, r = 0, len(nums) - 1
        while l < r:
            mid = (l + r) // 2
            if mid % 2 == 0:
                if nums[mid] == nums[mid + 1]:
                    l = mid + 2
                else:
                    r = mid
            else:
                if nums[mid] == nums[mid - 1]:
                    l = mid + 1
                else:
                    r = mid
        return nums[l]

```
['Python3']