Beautiful Pairs

  • + 1 comment

    Solution of Beautiul Pairs

    def beautifulPairs(A, B):
        # Write your code here
        count = 0
        
        if len(A) == 1:
            return count
        
        for i in A:
            if i in B:
                count += 1
                B.remove(i)
                
        if (count < len(A)):
            return count + 1 
        else:
             return len(A) - 1