LeetCode solutions

2331. Intersection of Multiple Arrays

My accepted Python solution to LeetCode problem 2331, Intersection of Multiple Arrays, running in 3ms.

  • Difficulty: Easy
  • Python
  • Runtime 3ms
  • Memory 17.7MB

Read the problem on LeetCode View on GitHub

Python

Accepted on LeetCode — runtime 3ms, memory 17.7MB, accepted 2026-01-01.

python
class Solution:
    def intersection(self, nums: List[List[int]]) -> List[int]:
        count = {}
        for arr in nums:
            for num in arr:
                count[num] = count.get(num, 0) + 1
        n = len(nums)
        return sorted([num for num, c in count.items() if c == n])

Source