• + 0 comments
    def sockMerchant(n, ar):
        # Write your code here
        count=0
        dict_values={}
        for socks in ar:
            if socks in dict_values:
                dict_values[socks]+=1
            else:
                dict_values[socks]=1
        for socks,pairs in dict_values.items():
            if pairs>=2:
                count+=pairs//2
        return count