We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 896a8a6 commit 5c5b632Copy full SHA for 5c5b632
leet code/75 leetcode/260. Single Number III.py
@@ -17,7 +17,26 @@ def single_number(nums):
17
data.append(i)
18
if len(data)==2:
19
return data
20
-
+
21
22
+def single_number(nums):
23
+ n = len(nums)
24
+ result = [0, 0]
25
+ index = 0
26
27
+ for i in range(n):
28
+ found = False
29
+ for j in range(n):
30
+ if i != j and nums[i] == nums[j]:
31
+ found = True
32
+ break
33
+ if not found:
34
+ result[index] = nums[i]
35
+ index += 1
36
+ if index == 2:
37
38
39
+ return result
40
41
nums = list(map(int,input('enter the numbers: ').split(',')))
42
print(single_number(nums))
0 commit comments