1213. Intersection of Three Sorted Arrays

Обновлено: 2024-03-12
1 мин
[]

Содержание

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