Intersection Point
MediumAcc. 88.2%
+35 XP 15
Shared Identity
What items exist in both collections?
The Assignment
Your function receives arr1 and arr2.
- Iterate through
arr1. - For every element, check if it exists in
arr2. - If it does, print it. (Ignore duplicates for now—one print per match).
01EXAMPLE 1
Input
arr1=[1, 2], arr2=[2, 3]Output
2Explanation: 2 is shared.
Constraints
- Simple nested loop check.
ArraysSet Logic
JavaScriptSystem handles I/O — write your function only
Loading...
1 Hidden
Input Arguments
arr1[1,2,2,1]
arr2[2,2]
Expected Output
2 2
Click RUN to test your solution