easy peasy python with lot of comments
\tdef singleNonDuplicate(self, nums: List[int]) -> int:\n        ln = len(nums)\n        if ln == 1:\n            return nums[0]\n        \n        s, e = 0, ln
\tdef singleNonDuplicate(self, nums: List[int]) -> int:\n        ln = len(nums)\n        if ln == 1:\n            return nums[0]\n        \n        s, e = 0, ln-1\n        while s <= e:\n            mid = (e-s)//2 + s\n            # print(s, e, mid)\n            if (mid == 0 or nums[mid-1] != nums[mid]) and (mid == ln-1 or nums[mid+1] != nums[mid]):\n                return nums[mid]\n            # total elements on left of mid including mid is (mid+1)\n            # case 1: mid-1 == mid and elements on left including mid are even\n            # case 2: mid+1 == mid and elements on left excluding mid are even\n            # for case 1 and case 2: s = mid + 1 or s = mid + 2 (for case 2, mid == mid+1)\n            # so can move to mid + 2\n            if(mid == 0 or nums[mid-1] == nums[mid]) and (mid+1) % 2 == 0:\n                s = mid + 1\n            elif (mid == ln-1 or nums[mid+1] == nums[mid]) and (mid) % 2 == 0:\n                s = mid + 2\n            else:\n                e = mid - 1\n        \n        return -1
['Binary Search', 'Binary Tree', 'Python', 'Python3']