You are viewing a single comment's thread. Return to all comments →
Python Oneliner Code
def beautifulPairs(A, B): return len(A)-sum((Counter(A)-Counter(B)).values())+1 if sum((Counter(A)-Counter(B)).values()) else len(A)-1
Better Code
def beautifulPairs(A, B): diff = sum((Counter(A) - Counter(B)).values()) return len(A) - diff +1 if diff else len(A) - 1
Seems like cookies are disabled on this browser, please enable them to open this website
Beautiful Pairs
You are viewing a single comment's thread. Return to all comments →
Python Oneliner Code
Better Code