Java Solution


  • 0
    P

    '''
    class Solution {
    public int singleNonDuplicate(int[] nums) {
    int i = 0;
    if(nums.length > 2){
    while(i + 2 < nums.length){
    if(nums[i] != nums[i+1])
    return nums[i];
    i += 2;
    }
    return nums[i];
    }
    return nums[0];
    }
    }
    '''


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.