Java beats 100%
Java beats 100%\n\n\n\n# Code\n\nclass Solution {\n    public int singleNonDuplicate(int[] nums) {\n        int left = 0, right = nums.length - 1;\n        whil
Java beats 100%\n![image.png](https://assets.leetcode.com/users/images/32197143-98e9-480a-bfa5-dc0a52260b56_1715408532.546289.png)\n\n\n# Code\n```\nclass Solution {\n    public int singleNonDuplicate(int[] nums) {\n        int left = 0, right = nums.length - 1;\n        while (left < right) {\n            int mid = (left + right) / 2;\n            if (mid % 2 == 1) {\n                mid--;\n            }\n            if (nums[mid] != nums[mid + 1]) {\n                right = mid;\n            } else {\n                left = mid + 2;\n            }\n        }\n        return nums[left];\n    }\n}\n```
['Java']