1213. Intersection of Three Sorted Arrays

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

On This Page

LeetCode problem 1213

class Solution:
    def arraysIntersection(
        self, arr1: List[int], arr2: List[int], arr3: List[int]
    ) -> List[int]:
        res = []
        for x in arr1:
            i = bisect_left(arr2, x)
            j = bisect_left(arr3, x)
            if i < len(arr2) and j < len(arr3) and arr2[i] == x and arr3[j] == x:
                res.append(x)
        return res