LeetCode 136.

Tags:

package lc_136;

public class Solution {
    public int singleNumber(int[] nums) {
        int ans = 0;
        for (int num: nums){
            ans = ans ^ num;
        }
        return ans;
    }
}

Check out the description of this problem at LC 136.