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

    }
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter