• + 0 comments

    My solution with Python

    def sockMerchant(n, ar): # Write your code here ar.sort() count = 0 dict = {} for number in ar: if number not in dict: dict[number] = 1 else: value = dict.get(number) dict[number] = value + 1

    for key, value in dict.items():
        count += (value // 2)
    
    return count