Back to problems

Implement Modified Intersection

Algorithm · Meta · Easy

Create a function that accepts two arrays of integers and produces their union, rather than their common elements. For example, [7, 8, 9] together with [8, 9, 10] should produce [7, 8, 9, 10]; [3, 4] together with [3, 4] should produce [3, 4]. Each value in the returned array must appear only once, and its ordering does not matter. Neither input array will contain more than 1000 elements. Example The output contains every distinct number found in either input array.

Checking your access…