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)
leetcode-第10周双周赛-5079-三个有序数组的交集的更多相关文章
- [LeetCode] Convert Sorted Array to Binary Search Tree 将有序数组转为二叉搜索树
Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 这道 ...
- Java实现 LeetCode第30场双周赛 (题号5177,5445,5446,5447)
这套题不算难,但是因为是昨天晚上太晚了,好久没有大晚上写过代码了,有点不适应,今天上午一看还是挺简单的 5177. 转变日期格式 给你一个字符串 date ,它的格式为 Day Month Yea ...
- LeetCode 第 15 场双周赛
1287.有序数组中出现次数超过25%的元素 1288.删除被覆盖区间 1286.字母组合迭代器 1289.下降路径最小和 II 下降和不能只保留原数组中最小的两个,hacked. 1287.有序数组 ...
- [LeetCode] 4. Median of Two Sorted Arrays 两个有序数组的中位数
There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two ...
- [LeetCode] Find Minimum in Rotated Sorted Array 寻找旋转有序数组的最小值
Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 migh ...
- [LeetCode] 80. Remove Duplicates from Sorted Array II ☆☆☆(从有序数组中删除重复项之二)
https://leetcode.com/problems/remove-duplicates-from-sorted-array-ii/discuss/27976/3-6-easy-lines-C% ...
- LeetCode 33 Search in Rotated Sorted Array(循环有序数组中进行查找操作)
题目链接 :https://leetcode.com/problems/search-in-rotated-sorted-array/?tab=Description Problem :当前的数组 ...
- LeetCode第8场双周赛(Java)
这次我只做对一题. 原因是题目返回值类型有误,写的是 String[] ,实际上应该返回 List<String> . 好吧,只能自认倒霉.就当涨涨经验. 5068. 前后拼接 解题思路 ...
- LeetCode 第 14 场双周赛
基础的 api 还是不够熟悉啊 5112. 十六进制魔术数字 class Solution { public: char *lltoa(long long num, char *str, int ra ...
- leetcode-第10周双周赛-5081-歩进数
题目描述: 自己的提交:参考全排列 class Solution: def countSteppingNumbers(self, low: int, high: int) -> List[int ...
随机推荐
- [USACO06JAN]牛的舞会The Cow Prom
题目描述 The N (2 <= N <= 10,000) cows are so excited: it's prom night! They are dressed in their ...
- touchWX 自定义组件以及传值
创建如图文件 index.wxc: <template> <view class="wx-test" bindtap="handleTap"& ...
- centos 时区设置初认识
由于一些需要,我租用了一个海外服务器,并开始了我的centos之旅. 由于之前一直用虚拟机,而且在国内,所以不需要考虑时区的问题,但是现在,这个服务器是在海外的,所以就必须考虑时区的问题了.更何况我的 ...
- springboot + zipkin(brave-okhttp实现)
一.前提 1.zipkin基本知识:附8 zipkin 2.启动zipkin server: 2.1.在官网下载服务jar,http://zipkin.io/pages/quickstart.html ...
- chrome无法拖拽离线安装CRX格式插件解决方法
原文:http://chromecj.com/utilities/2018-09/1525.html 摘要 : chrome 67版本后无法拖拽离线安装CRX格式插件的解决方法 有一部分网友反映子 ...
- CentOS提示::unknown filesystem type 'ntfs'自动挂载NTFS分区的U盘或者移动硬盘
CentOS默认源里没有NTFS-3G,想要添加ntfs支持,无非是自己下载编译安装或者加源yum安装.重新安装了一个CentOS7,用的是添加aliyun的epel源来yum安装的方式,简单易行. ...
- thymeleaf种处理select,radio和文字回显的问题
select根据后台集合显示下列列表 <select class="form-control" name="parentId" > <opti ...
- 解析Spring第三天(面向切面AOP)
面向切面:AOP 在不修改源代码的基础上,对方法进行增强.AOP的底层原理就是代理技术(第一种:jdk的动态代理(编写程序必须要有接口).第二种:cglib代理技术(生成类的子类).如果编写的程序有借 ...
- delphi获得文件大小
大概有这些方法可以获得文件大小 FileSizeByName(需要引用IdGlobal单元) GetFileSize FileSize(不能获得正在使用的文件大小) FileSeek TFileStr ...
- Android中的Serialable和Parcelable的区别
本文主要介绍Parcelable和Serializable的作用.效率.区别及选择,关于Serializable的介绍见<Java中的序列化Serialable高级详解> 1.作用 Ser ...