leetcode-第10周双周赛-5079-三个有序数组的交集

题目描述:

 

 自己的提交:

class Solution:
    def arraysIntersection(self, arr1: List[int], arr2: List[int], arr3: List[int]) -> List[int]:
        arr = arr1 + arr2 +arr3
        res = []
        for i in arr:
            if arr.count(i)==3 and i  not in res:
                res.append(i)
        return res

另:

class Solution(object):
    def arraysIntersection(self, A, B, C):
        S = set(A) & set(B) & set(C)
        return sorted(S)

 

posted @ 2019-10-07 13:24  oldby  阅读(262)  评论(0编辑  收藏  举报