Skip to content

Commit bd55960

Browse files
authored
Solution
1 parent 52efc03 commit bd55960

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/python3
2+
3+
import math
4+
import os
5+
import random
6+
import re
7+
import sys
8+
9+
# Complete the sockMerchant function below.
10+
def sockMerchant(n, ar):
11+
count = 0
12+
ar.sort()
13+
ar.append('#')
14+
i = 0
15+
while i<n:
16+
if ar[i]==ar[i+1]:
17+
count = count+1
18+
i+=2
19+
else:
20+
i+=1
21+
return count
22+
23+
if __name__ == '__main__':
24+
fptr = open(os.environ['OUTPUT_PATH'], 'w')
25+
26+
n = int(input())
27+
28+
ar = list(map(int, input().rstrip().split()))
29+
30+
result = sockMerchant(n, ar)
31+
32+
fptr.write(str(result) + '\n')
33+
34+
fptr.close()

0 commit comments

Comments
 (0)