两个数组的交集
2025-4-20
| 2025-4-20
Words 258Read Time 1 min
type
status
date
slug
summary
tags
category
icon
password

题目:

给定两个数组 nums1nums2 ,返回 它们的交集 。输出结果中的每个元素一定是 唯一 的。我们可以 不考虑输出结果的顺序
来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/SNJvJP 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
示例 1:
示例 2:
提示:
  • 1 <= nums1.length, nums2.length <= 1000
  • 0 <= nums1[i], nums2[i] <= 1000

思路:

  • 把一个数组装进list中,遍历第二个数组,把合适的数据添加进去

代码:

结果:

notion image
两个数组的交集II两个数对之间的最大乘积差
Loading...