Implement Modified Intersection

Asked at Meta · Coding & Leetcode-style Questions · Difficulty: Easy

Write a function that takes two integer arrays as input and returns their union instead of the intersection. Test cases include: [1, 2, 3], [2, 3, 4] should return [1, 2, 3, 4]; [5, 6], [5, 6] should return [5, 6]. Note: The elements in the result array must be unique, and they can be returned in any order. The length of each input array will not exceed 1000.

Loading the problem…