Skip to content

Instantly share code, notes, and snippets.

@lumie31
Created May 16, 2022 20:49
Cassidy's Interview question of the week Solution
function maximizedArray(arr1, arr2) {
let mergedArr = arr1.concat(arr2);
let uniqueValues = new Set(mergedArr);
let uniqueArr = [...uniqueValues];
let sortedArr = uniqueArr.sort((a, b) => b - a);
let result = sortedArr.slice(0, arr1.length);
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment