Write a program to find the intersection of two arrays.
EasyProblem Statement
Write a program to find the intersection of two arrays.
Sample Input
arr1 = {1, 2, 3, 4, 5}, arr2 = {4, 5, 6, 7, 8}Sample Output
Intersection = {4, 5}
Limits
Time: 2s · Memory: 256 MB
Code Editor
00:00
#include <iostream>
#include <vector>
int main() {
std::vector<int> arr1 = {1, 2, 3, 4, 5};
std::vector<int> arr2 = {4, 5, 6, 7, 8};
// Logic to find intersection
return 0;
}
Input
arr1 = {1, 2, 3, 4, 5}, arr2 = {4, 5, 6, 7, 8}Expected Output
Intersection = {4, 5}