class Solution(object):
def singleNumber(self, nums):
nums.sort()
ct=0
i=0
a=[0,0]
while i <len(nums):
if i==len(nums)2:
return nums[len(nums)2],nums[len(nums)1]
elif i==len(nums)1:
return a[0],nums[len(nums)1]
elif nums[i]==nums[i+1]:
i+=2
else:
a[ct]=nums[i]
ct+=1
if ct==2:
return a
else:
i+=1
Python O(n) Solution



@LeoEatle The problem says the numbers will show up exactly twice, so your case is not suitable in this situation. :]