diff --git a/Leetcode/single-number-iii#39.java b/Leetcode/single-number-iii#39.java new file mode 100644 index 0000000..0c6e886 --- /dev/null +++ b/Leetcode/single-number-iii#39.java @@ -0,0 +1,29 @@ +class Solution { + public int[] singleNumber(int[] nums) { + int res = 0; + for(int i=0;i 0) + a = (a^nums[i]) ; + else + b = (b^nums[i]) ; + } + + int[] ar = new int[2]; + + if(a<=b){ + ar[0]=a; + ar[1]=b; + }else{ + ar[0]=b; + ar[1]=a; + } + + return ar; + } +}