2248. Intersection of Multiple Arrays

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 2248

class Solution:
    def intersection(self, nums: List[List[int]]) -> List[int]:
        cnt = Counter()
        res = []
        for arr in nums:
            for x in arr:
                cnt[x] += 1
                if cnt[x] == len(nums):
                    res.append(x)
        res.sort()
        return res