C++ | O(Log n) | O(1)
\n int singleNonDuplicate(vector<int>& nums) {\n        int start = 0 , end = nums.size()-1;\n        \n        if(nums.size() == 1)    return nums[0]; \n      
```\n int singleNonDuplicate(vector<int>& nums) {\n        int start = 0 , end = nums.size()-1;\n        \n        if(nums.size() == 1)    return nums[0]; \n        if(nums[0] != nums[1]) return nums[0];\n        if(nums[end] != nums[end-1]) return nums[end];\n            \n        while(start<=end)\n        {\n            int mid = (start+end)/2;\n            if(mid%2 == 0)\n            {\n                if(nums[mid] == nums[mid+1])\n                start = mid+1;\n                else\n                    end = mid-1;\n            }\n            else if(mid%2 != 0)\n            {\n                if(nums[mid] == nums[mid+1])\n                    end = mid-1;\n                else\n                    start = mid+1;\n            }\n             if(nums[mid] != nums[mid+1] && nums[mid] != nums[mid-1])\n                return nums[mid];\n        }\n        \n        return 0;\n    }\n\t```
['C', 'Binary Tree']