首页 > 编程语言 > 详细

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

时间:2019-10-07 14:26:54      阅读:58      评论:0      收藏:0      [点我收藏+]

题目描述:

技术分享图片

 

 自己的提交:

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)

 

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

原文:https://www.cnblogs.com/oldby/p/11630120.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!