curriculum/challenges/english/blocks/daily-coding-challenges-javascript/697a49e9860d24853adef67d.md
Given an array of jump scores for athletes, calculate their start delay times for the cross-country portion of the Nordic Combined.
The athlete with the highest jump score starts first (0 second delay). All other athletes start later based on how far behind their jump score is compared to the best jump.
To calculate the delay for each athlete, subtract the athlete's jump score from the best overall jump score and multiply the result by 1.5. Round the delay up to the nearest integer.
calculateStartDelays([120, 110, 125]) should return [8, 23, 0].
assert.deepEqual(calculateStartDelays([120, 110, 125]), [8, 23, 0]);
calculateStartDelays([118, 125, 122, 120]) should return [11, 0, 5, 8].
assert.deepEqual(calculateStartDelays([118, 125, 122, 120]), [11, 0, 5, 8]);
calculateStartDelays([100, 105, 95, 110, 120, 115, 108]) should return [30, 23, 38, 15, 0, 8, 18].
assert.deepEqual(calculateStartDelays([100, 105, 95, 110, 120, 115, 108]), [30, 23, 38, 15, 0, 8, 18]);
calculateStartDelays([130, 125, 128, 120, 118, 122, 127, 115, 132, 124]) should return [3, 11, 6, 18, 21, 15, 8, 26, 0, 12].
assert.deepEqual(calculateStartDelays([130, 125, 128, 120, 118, 122, 127, 115, 132, 124]), [3, 11, 6, 18, 21, 15, 8, 26, 0, 12]);
function calculateStartDelays(jumpScores) {
return jumpScores
}
function calculateStartDelays(jumpScores) {
const bestJump = Math.max(...jumpScores);
return jumpScores.map(score => Math.ceil((bestJump - score) * 1.5));
}