Easy java binary solution 100% faster
Please upvote if you find it helpful\n\nclass Solution {\n    public int singleNonDuplicate(int[] nums) {\n        if(nums.length==1){\n            return nums[
Please upvote if you find it helpful\n```\nclass Solution {\n    public int singleNonDuplicate(int[] nums) {\n        if(nums.length==1){\n            return nums[0];\n        }\n        int l=0, h=nums.length-1;\n        while(l<h){\n            int mid = l + (h-l)/2;\n            if(mid-1>=0 && nums[mid] == nums[mid-1]){ \n                if(mid%2 == 1){    \n                    l = mid+1;\n                }\n                else h = mid-1;\n            }\n            else if(mid+1<nums.length && nums[mid] == nums[mid+1]){\n                if(mid%2 == 1){\n                    h = mid-1;\n                }\n                else l = mid+1;\n            }\n            else return nums[mid];\n        }\n        return nums[h];\n    }\n}\n\n```
['Binary Search', 'Binary Tree', 'Java']