mirror of
https://github.com/arkorty/LeetCode.git
synced 2026-03-17 16:51:46 +00:00
10 lines
225 B
Java
10 lines
225 B
Java
class Solution {
|
|
public int singleNonDuplicate(int[] nums) {
|
|
for (int i = 0; i < nums.length - 1; i += 2)
|
|
if (nums[i] != nums[i + 1])
|
|
return i;
|
|
|
|
return nums.length - 1;
|
|
}
|
|
}
|