🚀Simplest Solution🚀||🔥Binary Search||🔥C++🔥|| Python3
Consider\uD83D\uDC4D\n\n                    Please Upvote If You Find It Helpful\n\n# Intuition \nIntitution is very simple we have to find the which appears on
# Consider\uD83D\uDC4D\n```\n                    Please Upvote If You Find It Helpful\n```\n# Intuition \nIntitution is very simple we have to find the which appears once.\nWe can see in array it follows a pattern all the duplicate pairs are at **Even and Odd positions** this pattern is not satisfied when there is a single element in the array.\nFor example : [1,1,2,3,3,4,4,8,8]\nIn this array `1` is at 0 and 1 index. This pattern follows for all pairs.\n\n    How we can implement Binary Search here.\n    1. Take left and right pointers . \n        `start` points to start of list. `end` points to end of the list.\n    2. Find `mid`.\n        If mid is `even`, then it\'s duplicate should be in next index.\n        or if `mid` is `odd`, then it\'s duplicate  should be in previous index.\n        For checking `mid` I am using Bit manipulation `mid^1` it means if `mid` is `even` it check at `odd` position and if it is `odd` it will check at `even` position.\n        check these two conditions, \n        if any of the conditions is satisfied,\n        then pattern is not missed, \n        so check in next half of the array. i.e, `start` = mid + 1\n        if condition is not satisfied, then the pattern is missed.\n        so, single number must be before mid.\n        so, update `end` to mid-1.\n    3. At last return the nums[start]\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach : Binary Search\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(logn)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```C++ []\nclass Solution {\npublic:\n    int singleNonDuplicate(vector<int>& nums) {\n        int start=0, end=nums.size()-2;\n        while(end>=start){\n            int mid = (end+start)/2;\n            if(nums[mid] == nums[mid^1])\n                start = mid+1;\n            else\n                end = mid-1;\n        }\n        return nums[start];\n    }\n};\n\n```\n```python []\nclass Solution:\n    def singleNonDuplicate(self, nums: List[int]) -> int:\n        start = 0\n        end = len(nums)-2\n        while end>=start:\n            mid = (end+start)//2\n            if nums[mid] == nums[mid^1]:\n                start = mid+1\n            else:\n                end = mid-1\n        return nums[start]\n```\n```\n                            Give a \uD83D\uDC4D. It motivates me alot\n```\nLet\'s Connect On [Linkedin](https://www.linkedin.com/in/naman-agarwal-0551aa1aa/)
['Array', 'Binary Search', 'Python', 'C++', 'Python3']