You are viewing a single comment's thread. Return to all comments →
def beautifulPairs(A, B): a_number_freq = Counter(A) b_number_freq = Counter(B) ans = sum(min(a_number_freq[k], b_number_freq[k]) for k in a_number_freq) return ans + 1 if ans < len(A) else ans - 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 →