Files
wehub-resource-sync dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 11:55:53 +08:00

1.4 KiB

id, title, challengeType, dashedName
id title challengeType dashedName
697a49e6ff50d756c9b6935f Challenge 182: 2026 Winter Games Day 3: Biathlon 28 challenge-182

--description--

Given an array of integers, where each value represents the number of targets hit in a single round of a biathlon, return the total penalty distance the athlete must ski.

  • Each round consists of 5 targets.
  • Each missed target results in a 150 meter penalty loop.

--hints--

calculatePenaltyDistance([4, 4]) should return 300.

assert.equal(calculatePenaltyDistance([4, 4]), 300);

calculatePenaltyDistance([5, 5]) should return 0.

assert.equal(calculatePenaltyDistance([5, 5]), 0);

calculatePenaltyDistance([4, 5, 3, 5]) should return 450.

assert.equal(calculatePenaltyDistance([4, 5, 3, 5]), 450);

calculatePenaltyDistance([5, 4, 5, 5]) should return 150.

assert.equal(calculatePenaltyDistance([5, 4, 5, 5]), 150);

calculatePenaltyDistance([4, 3, 0, 3]) should return 1500.

assert.equal(calculatePenaltyDistance([4, 3, 0, 3]), 1500);

--seed--

--seed-contents--

function calculatePenaltyDistance(rounds) {

  return rounds;
}

--solutions--

function calculatePenaltyDistance(rounds) {
  let totalPenalty = 0;

  for (const hits of rounds) {
    const misses = 5 - hits;
    totalPenalty += misses * 150;
  }

  return totalPenalty;
}