350. Intersection of Two Arrays II
来源:互联网 发布:java接口自动化测试 编辑:程序博客网 时间:2024/06/05 14:39
- 350. Intersection of Two Arrays II
Given two arrays, write a function to compute their intersection.
Example:
Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2].
用的python:
class Solution(object): def intersect(self, nums1,nums2): """ :type nums1: List[int] :type nums2: List[int] :rtype: List[int] """ res =[] for item in nums1: if item in nums2: nums2.remove(item) res.append(item) return res
感觉虽然AC了,但是自己用的方法不好。。不是人家考查的点,所以还需要用c++/java再写一下思路,诸如利用java HashMap等等
未完待续…
阅读全文
0 0
- 350. Intersection of Two Arrays II
- LeetCode 350. Intersection of Two Arrays II
- leetcode.350. Intersection of Two Arrays II
- 350. Intersection of Two Arrays II【E】
- 350. Intersection of Two Arrays II
- [leetcode] 350. Intersection of Two Arrays II
- Leetcode 350. Intersection of Two Arrays II
- leetcode 350. Intersection of Two Arrays II
- 350. Intersection of Two Arrays II
- 350. Intersection of Two Arrays II
- Leetcode 350. Intersection of Two Arrays II
- [leetcode] 350. Intersection of Two Arrays II
- leetcode 350. Intersection of Two Arrays II
- 350. Intersection of Two Arrays II
- 350. Intersection of Two Arrays II
- 【leetcode】350. Intersection of Two Arrays II
- 350. Intersection of Two Arrays II
- 350. Intersection of Two Arrays II
- nohup 输出重定向 2015-10-20 12:25 7264人阅读 评论(0) 收藏 举报 http://moralistxp.blog.163.com/blog/static/1161103
- 总结ibatis与mybatis区别
- C++11解析url
- tp5在HTML上添加、修改、删除数据库
- intellij idea 忽略文件不提交
- 350. Intersection of Two Arrays II
- Integer相等判断
- SharePoint 2016:找不到 Project Web App 实例。请在访问此页面之前至少创建一个 PWA 实例。
- 深机笔记
- 常用数据库
- Connection closed by foreign host. Disconnected from remote host
- UDP中recvfrom函数与sendto函数分析
- MOOC清华《程序设计基础》第5章:八皇后问题-代码二
- spark sql基本使用方法介绍(转载)