Python O(lg n) by binary search 85%+ [w/ Visualization]
Python O(lg n) by binary search\n\n---\n\nHint:\n\nGroup each numbers in pairs, and launch binary search to locate the first index of mis-matched pair.\n\n---\n
Python O(lg n) by binary search\n\n---\n\nHint:\n\nGroup each numbers in pairs, and launch binary search to locate the first index of mis-matched pair.\n\n---\n\n**Illustration and Visualization**:\n\n![image](https://assets.leetcode.com/users/brianchiang_tw/image_1589277233.png)\n\n---\n\n**Implementation** by binary search:\n\n```\nclass Solution:\n    def singleNonDuplicate(self, nums: List[int]) -> int:\n        \n        size = len(nums)\n        \n        left, right = 0, size // 2\n        \n        while left < right:\n            \n            pair_index = left + ( right - left ) // 2\n            \n            if nums[2*pair_index] != nums[2*pair_index+1]:\n                # If current pair is mis-matched\n                # then go left-half to find the first pair of mis-match\n                right = pair_index\n            \n            else:\n                # If current pair is with the same number appeared twice\n                # then go right-half to find the first pair of mis-match\n                left = pair_index + 1\n        \n        # when the while loop terminates, left = right = the first pair index of mis-match\n        return nums[2*left]\n```
['Binary Search', 'Python', 'Python3']