subject : Find the only two elements in the array that appear once , The other elements appear twice .
Example :
Input: [1,2,1,3,2,5]
Output: [3,5]
Code :
class Solution:
def func(self , nums):
res = []
for i in nums:
if i not in res:res.append(i)
else:res.pop(res.index(i))
return res
a = [1,2,1,3,2,5]
s = Solution()
print(s.func(a))
Output :
[3,5]