/Array-Sum-Changer

This algorithm will mutate an array of whole numbers equally, so that the new array sum is equal to the inputed sum.

Primary LanguageJavaScript

Array Sum Changer

This algorithm will mutate an array of whole numbers equally, so that the new array sum is equal to the inputed sum.

Example:

let numbers = [ 1, 2, 3, 4, 5, 6, 7 ];

let sumChange = arraySumChanger(50, numbers);

console.log(sumChange)
// expected ouput: [ 5, 5, 6, 7, 8, 9, 10 ]