題目:Given an array of numbersnums
, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once.
For example:
Givennums = [1, 2, 1, 3, 2, 5]
, return[3, 5]
.
Note:
[5, 3]
is also correct.public class Solution { public int[] singleNumber(int[] nums) { int[] result=new int[2]; List<integer> temp=new ArrayList<integer>(); for(int i=0;i<nums.length;i++) else="" return="" pre=""> </nums.length;i++)></integer></integer>