Easy Java Solution | Faster than 100% | O(logN)
\npublic int singleNonDuplicate(int[] nums) {\n\tif(nums.length <= 2){\n\t\treturn nums[0];\n\t}\n\tint low = 0;\n\tint high = nums.length - 1;\n\tint mid;\n\tw
```\npublic int singleNonDuplicate(int[] nums) {\n\tif(nums.length <= 2){\n\t\treturn nums[0];\n\t}\n\tint low = 0;\n\tint high = nums.length - 1;\n\tint mid;\n\twhile(low <= high){\n\t\tmid = low + (high - low) /2;\n\t\t\n\t\t//Check to see if element is in the middle\n\t\tif(mid > 0 && mid < nums.length - 1 && nums[mid] != nums[mid - 1] && nums[mid] != nums[mid + 1]){\n\t\t\treturn nums[mid];\n\t\t}\n\t\t//This check\'s if the array on then left part, till the mid has first occurence of the pair in even index position\n\t\t//Because once the single element comes the first occurrence of the pair will always be in  odd index position\n\t\t//In that case we have to search for the element on the right part of the array\n\t\telse if((mid > 0 && nums[mid] == nums[mid - 1] && (mid - 1) % 2 == 0) || ( mid < nums.length - 1 && nums[mid] == nums[mid + 1] && (mid + 1) % 2 != 0)){\n\t\t\tlow = mid + 1;\n\t\t}\n\t\telse{\n\t\t\thigh = mid - 1;\n\t\t}\n\t}\n\n\treturn nums[low];\n}\n```
['Binary Tree', 'Java']