Sales by Match

  • + 0 comments
    #Python Solution
    def sockMerchant(n, ar):
        pairs = 0
        colors = set(ar)
        
        for color in colors:
            pairs += math.floor(ar.count(color)/2)
        
        return pairs