i think there is another way to represent to the requested solution
Additional information
function getTheHighstSumInArr(arr): {
const arrToWork = arr.sort((a, b) => a - b);
[...new Set(arrToWork)];
const arrToSum: number[] = [];
let index = arr.length;
for (let i = 0; i < 4; i++) {
arrToSum.push(arrToWork[--index]);
}
const res = arrToSum.reduce((a, b) => {
return a + b;
});
return res;
}
Code of Conduct
[X] I have read and agree to the Codinasion project's Code of Conduct
What would you like to share?
i think there is another way to represent to the requested solution
Additional information
Code of Conduct