Easy Python solution


  • 0
    K
    res = []
    for num, count in (collections.Counter(nums1) & collections.Counter(nums2)).items():
            res += [num] * count
    return res
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.