• + 0 comments

    Python 3 Solution:

    def sockMerchant(n, ar):
        dic_stocks = {}
        count = 0
        for x in ar:
            if x in dic_stocks:
                dic_stocks[x] += 1 
            else:
                dic_stocks[x] = 1
        for x in dic_stocks:
            count += dic_stocks[x] // 2
        return count