Skip to content
This repository has been archived by the owner on Feb 14, 2023. It is now read-only.

350. 两个数组的交集 II #22

Open
liujiangs opened this issue Jul 13, 2020 · 0 comments
Open

350. 两个数组的交集 II #22

liujiangs opened this issue Jul 13, 2020 · 0 comments
Labels
Easy 史莱姆 Leetcode daily topic 每日药丸 世尘 世界的尘埃哒

Comments

@liujiangs
Copy link
Collaborator

做出来的第一道简单题
思路:两个循环 把相同的数字取出来 并且里面的循环去掉取出的数字 避免外部循环出现相同的数字
var intersect = function(nums1, nums2) { var arr = [] nums1.map((item) => { nums2.some((ite,idx) => { if(item === ite) { arr.push(item) nums2[idx] = null return true } }) }) return arr };

@liujiangs liujiangs added Leetcode daily topic 每日药丸 Easy 史莱姆 世尘 世界的尘埃哒 labels Jul 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Easy 史莱姆 Leetcode daily topic 每日药丸 世尘 世界的尘埃哒
Projects
None yet
Development

No branches or pull requests

1 participant