[Runtime 0 ms] clear and easy solution
Intuition\nIf the number in the current index is not equal to one of the numbers on either side, then the number we are looking for is that\n\n# Approach\n Desc
# Intuition\nIf the number in the current index is not equal to one of the numbers on either side, then the number we are looking for is that\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\nRuntime : 0 ms      Beats : 100%\nMemory :48 MB       Beats  :72.85%\n\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int singleNonDuplicate(int[] nums) {\n        if(nums.length == 1 ) return nums[0];\n\n        if(nums[0] != nums[1]) return nums[0]; // first index\n        if(nums[nums.length-1] != nums[nums.length-2]) return nums[nums.length-1]; // last index \n\n        for (int i = 1; i < nums.length-1; i++) {\n            if(!isD(nums,i)){\n                return nums[i];\n            }\n        }\n    \n        return -1;\n\n    }\n    private static boolean isD(int[] nums, int index){\n        return nums[index - 1] == nums[index] || nums[index] == nums[index + 1];\n    }\n}\n```
['Array', 'Binary Search', 'Java']