Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Finding unique number in the array

class Solution {
    public int singleNumber(int[] nums) {
        int n=0;
        for(int i:nums){
            n=n^i;
        }
        return n;
    }
}
Source by leetcode.com #
 
PREVIOUS NEXT
Tagged: #Finding #unique #number #array
ADD COMMENT
Topic
Name
5+2 =