• + 1 comment

    Python 3:

    def sockMerchant(n, ar):
        # Write your code here
        NewSockType = []
        Pairs = 0
        for sock in ar:
            if sock not in NewSockType:
                NewSockType.append(sock)
            else:
                Pairs += 1
                NewSockType.remove(sock)
        return Pairs