mirror of
https://github.com/arkorty/LeetCode.git
synced 2026-03-17 16:51:46 +00:00
Initial commit
This commit is contained in:
9
Medium/single-element-in-a-sorted-array/Solution.java
Normal file
9
Medium/single-element-in-a-sorted-array/Solution.java
Normal file
@@ -0,0 +1,9 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user