• + 0 comments

    Here my solution in Python

    def sockMerchant(n, ar):
        # Write your code here
        pairs = {}
        for num in ar:
            pairs[num] = pairs.get(num, 0) + 1
        pairs_count = sum(count // 2 for count in pairs.values())
        return pairs_count