Guest User

Untitled

a guest
Jan 18th, 2021
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. def sockMerchant(n, ar):
  2.     count = 0
  3.     dict = {}
  4.     for i in range(len(ar)):
  5.         if ar[i] in dict:
  6.             dict[ar[i]] += 1
  7.         else:
  8.             dict[ar[i]] = 1
  9.            
  10.         if dict[ar[i]] % 2 == 0:
  11.             count += 1
  12.     return count
Advertisement
Add Comment
Please, Sign In to add comment