You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once.
10
+
#
11
+
#Example:
12
+
#
13
+
#Input: [1,2,1,3,2,5]
14
+
#Output: [3,5]
15
+
importcollectionsasc#Importing collections module
16
+
classSolution:
17
+
defsingleNumber(self, nums):
18
+
return [itemforitem, countinc.Counter(nums).items() ifcount==1] #Return the list containing excatly once element appearing in the array
0 commit comments