标签:des style blog color strong for
Problem Description:
Given an array of integers, every element appears twice except for one. Find that single one.
Solution:
1 public int singleNumber(int[] A) { 2 Arrays.sort(A); 3 for (int i = 1; i < A.length; i += 2) { 4 if (A[i-1] != A[i]) { 5 return A[i-1]; 6 } 7 } 8 9 return A[A.length - 1]; 10 }
Problem Single Number,布布扣,bubuko.com
标签:des style blog color strong for
原文地址:http://www.cnblogs.com/liew/p/3815083.html