public class Solution {
public int SingleNumber(int[] nums) {
int num = 0;
int length = nums.Length;
if (length == 1) {
return nums[0];
}
Array.Sort(nums);
for (int i = 0; i < length; i += 2) {
if (i+1 < length) {
if (nums[i] == nums[i + 1]) {
continue;
} else {
num = nums[i];
break;
}
} else {
num = nums[i];
break;
}
}
return num;
}
}
136.两个整形数组中找出不同的元素 Single Number
原文:http://www.cnblogs.com/xiejunzhao/p/5ae566566c63953a49f7dbb286274cf5.html