要求两个数组的交集,可以使用两个循环来遍历数组,判断数组中的元素是否相等,如果相等则将其添加到交集中。 下面是一个用C语言实现的示例代码: #include <stdio.h> void intersection(int arr1[], int arr2[], int size1, int size2) { int i, j; for (i = 0; i < size1; i++)
#@lc app=leetcode.cn id=349 lang=python3# #[349] 两个数组的交集# #https://leetcode-cn.com/problems/intersection-of-two-arrays/description/# #algorithms#Easy (60.49%)#Total Accepted: 15.1K#Total Submissions: 25K#Testcase Example: '[1,2,2,1]\n[2,2]'# #给定两个数组,编写一个函数...