Single Number

bit manipulation

 1 public class Solution {
 2     public int singleNumber(int[] A) {
 3         // IMPORTANT: Please reset any member data you declared, as
 4         // the same Solution instance will be reused for each test case.
 5         if(A == null || A.length == 0)
 6             return 0;
 7         int result = 0;
 8         for(int i : A)
 9             result ^= i;
10         return result;
11     }
12 }
原文地址:https://www.cnblogs.com/jasonC/p/3439749.html