Given an array of integers, every element appears twice except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
耐心看下我的思想演变过程吧,可能是大脑缺氧,用List装下标。
public int singleNumber(int[] nums) {
if (nums.length == 1)
return nums[0];
ArrayList<Integer> temp = new ArrayList<Integer>();