leetcode349
public class Solution {
public int[] Intersection(int[] nums1, int[] nums2) {
var list1 = nums1.ToList();
var list2 = nums2.ToList();
var list = list1.Intersect(list2);
return list.ToArray<int>();
}
}
https://leetcode.com/problems/intersection-of-two-arrays/#/description
leetcode349的更多相关文章
- leetcode349 350 Intersection of Two Arrays & II
""" Intersection of Two Arrays Given two arrays, write a function to compute their in ...
- [Swift]LeetCode349. 两个数组的交集 | Intersection of Two Arrays
Given two arrays, write a function to compute their intersection. Example 1: Input: nums1 = [1,2,2,1 ...
- leetcode349—Intersection of Two Arrays
Given two arrays, write a function to compute their intersection. Example 1: Input: nums1 = [1,2,2,1 ...
- [leetcode349]Intersection of Two Arrays
设计的很烂的一道题 List<Integer> res = new ArrayList<>(); // int l1 = nums1.length; // int l2 = n ...
- LeetCode349. 两个数组的交集
题目 给定两个数组,编写一个函数来计算它们的交集. 分析 数组元素值可以很大,所以不适合直接开数组进行哈希,这里要学习另一种哈希方式:集合 集合有三种,区别见下面代码随想录的Carl大佬的表格,总结的 ...
- LeetCode通关:哈希表六连,这个还真有点简单
精品刷题路线参考: https://github.com/youngyangyang04/leetcode-master https://github.com/chefyuan/algorithm-b ...
随机推荐
- smarty学习——缓存
存被用来保存一个文档的输出从而加速display()或fetch()函数的执行.如果一个函数被加进缓存,那么实际输出的内容将用缓存来代替. 缓存可让事物非常快速的执行,特别是带有长计算时间的模板.一旦 ...
- 创建ASM实例及ASM数据库
--======================== -- 创建ASM实例及ASM数据库 --======================== 一.ASM相关概念 1.什么是ASM(Auto Stor ...
- pm2 知识点
pm2:node进程管理工具 pm2 命令: pm2 命令 作用 pm start xxx.js 启动 xxx.js pm stop xxx.js 停止 xxx.js pm2 list 显示所有进程状 ...
- xml表头内容什么意思
我来给你解释一下吧,首先这个文件是一个xml文件,那么他里面的所有内容都符合xml语法规范,开头的<project></project>这最外层同样也是一个xml文件的标签,后 ...
- .NET : Func委托和Action委托
其实他们两个都是委托[代理]的简写形式. 一.[action<>]指定那些只有输入参数,没有返回值的委托 Delegate的代码: public delegate void myDeleg ...
- WCF揭秘学习笔记(4):可信赖会话、会话管理、队列、事务
可信赖会话 WCF的可信赖会话在绑定层保证消息只会被传输一次,并且保证消息间的顺序.当使用TCP通信时,协议本身保证了可靠性,但它只在两点间的网络 包这个层面提供了这样的保证.WCF的可信赖会话特性保 ...
- protobuf 协议 windows 下 C++ 环境搭建
1. 下载protobuf https://code.google.com/p/protobuf/downloads/list Protocol Buffers 2.5.0 full source - ...
- WPF Demo4
<Window x:Class="Demo4.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/ ...
- pfsense的nat配置
需要把内网192.168.1.100的80端口映射到外面,外网卡地址为192.168.1.200 firewall, firewall,nat,选择port forward标签,添加一个 在desti ...
- 关于 ake sure class name exists, is public, and has an empty constructor that is public
解决方法:自定义的fragment最好有一个Public的参数为空的构造函数,若需要传入一个参数,可以使用下面的方法 public FileViewFragment(){ } public stati ...