Intersection of Two Arrays

Easy
Arrays Array Hash Table Sorting

Given two arrays, return their intersection (unique common elements, any order, space-separated).

Constraints

1 ≤ length ≤ 1000

Examples

Example 1:
Input: 1 2 2 1 2 2
Output: 2
Example 2:
Input: 4 9 5 9 4 9 8 4
Output: 4 9
▲ Console

Install Talent Arabia

Get instant access to jobs and career tools on your device.