uniteUnique
Write a function that takes two or more arrays and returns a new array of unique values in the order of the original provided arrays.
Examples
uniteUnique([1, 3, 2], [5, 2, 1, 4], [2, 1]) → [1, 3, 2, 5, 4]
Starter code
function uniteUnique(...arrs) {
}
Complexity of the optimal solution
Time O(n), space O(n). Let n be the total number of elements across all arrays. Flattening the arrays takes O(n). Creating a `Set` from the flattened array takes O(n) on average. Spreading the set back to an array is also O(n). Overall complexity is linear.