• + 0 comments

    Python drawer = {}

    for sock in ar:
        drawer[sock] = drawer.get(sock, 0) + 1
    
    single_pair = sum(1 if x % 2 != 0 else 0 for x in drawer.values())
    matching_pair = int((len(ar) - single_pair)/2)
    
    return matching_pair