@Penghuan I like your solution, especially your explanation, which told us everything about this problem.

... to find the first even-index number not followed by the same number.

Your code is very concise, but not that easy to understand.

Why not do it with a Standard Binary Search. >3<

public class Solution { public int singleNonDuplicate(int[] nums) { int lo = 0, hi = nums.length-1; while (lo < hi) { int mid = lo + (hi - lo) / 2; int even = (mid % 2 == 0)? nums[mid] : nums[mid-1]; int followingOdd = (mid % 2 == 0)? nums[mid+1] : nums[mid]; if (even == followingOdd) { lo = mid + 1; } else { hi = (mid / 2) * 2; } } return nums[lo]; } }