The Union Set
MediumAcc. 91.4%
+30 XP 12
Complete Collection
Your goal is to print a value if it appears in either array, but only once.
The Assignment
Your function receives arr1 and arr2.
- Print all unique elements from
arr1. - For
arr2, only print an element if it was not already inarr1.
01EXAMPLE 1
Input
arr1=[1, 2], arr2=[2, 3]Output
1
2
3Explanation: 1, 2, 3 are unique.
Constraints
- Do not use Set().
ArraysSet Logic
JavaScriptSystem handles I/O — write your function only
Loading...
1 Hidden
Input Arguments
arr1[1,2]
arr2[2,3]
Expected Output
1 2 3
Click RUN to test your solution