【Leetcode】2956-1215

前言

非常简单的一个题目


思路

class Solution:
    def findIntersectionValues(self, nums1: List[int], nums2: List[int]) -> List[int]:
        t1, t2 = Counter(nums1), Counter(nums2)
        ans = [0,0]
        for k in t1:
            if k in t2:
                ans[0] += t1[k]
                ans[1] += t2[k]
        return ansn

posted @ 2024-07-16 14:54  TICSMC  阅读(8)  评论(0)    收藏  举报