136. Single Number
Given an array of integers, every element appears twice except for one. Find that single one.
题目含义:给定的数组中,每个数字出现两次,只有一个数字出现了一次,找出这个数字
1 public int singleNumber(int[] nums) { 2 int result = 0; 3 for (int i = 0; i < nums.length; i++) { 4 result ^= nums[i]; 5 } 6 return result; 7 }