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 ...
随机推荐
- zmq利用protobuf通信
protobuf序列化之后为二进制数据,数据中可能包含 ‘\0’,直接转换为char *类型会导致发送数据不完整.解决方法: void buildProtobufMsg(const string&am ...
- 链表vector
根据逻辑次序的复杂程度,大致可以将各种数据结构划分为线性结构.半线性结构与非线性结构三大类. 在线性结构中,各数据项按照一个线性次序构成一个整体.最为基本的线性结构统称为序列(sequence),根据 ...
- __stdcall,__cdecl,__fastcall,_stdcall,_cdecl,_fastcall 区别简介[转]
今天写线程函数时,发现msdn中对ThreadProc的定义有要求: DWORD WINAPI ThreadProc(LPVOID lpParameter); 不解为什么要用WINAPI宏定义,查 ...
- Homestead 安装其它的PHP版本
运行环境: 系统: win10 软件: virtualbox 6.2 vagrant 2.2.4 homestead 7.1.0 sudo apt-get update sudo apt-get -y ...
- js实现截取字符串后几位
var strs ="wdsdabcdefages" strs.substring(obj.filename.lastIndexOf("a")+1,strs.l ...
- JUC 一 ReentrantLock 可重入锁
java.util.concurrent.locks ReentrantLock即可重入锁,实现了Lock和Serializable接口 ReentrantLock和synchronized都是可重入 ...
- bzoj1040题解
[题意分析] 给你一个带权基环树森林,求它的点集的无邻点子集的最大权值和. [解题思路] 对于树的部分,做一遍拓扑排序+递推即可(f[i][j]表示第i个节点选取状态为j(0/1)可以得到的最大权值和 ...
- bzoj1010题解
[解题思路] 设s[i]=i+∑c[j](j∈[1,n]∩N) 易得转移方程f[i]=min{f[j]+(s[i]-s[j]-L-1)2},朴素算法复杂度O(n2). 考虑斜率优化:记T[i]=s[i ...
- kafka的消息组件
kafka的组件的介绍 produer:消息的生产者,往topic当中生产消息 consumer:消息的消费者,从topic当中消费消息 broker:kafka的服务器 zookeeper:kafk ...
- flutter 超出俩行点点点
Text( '${listItem["title"]}', overflow: TextOverflow.ellipsis, maxLines: 2, style: TextSty ...