Skip to content

Commit 2c98ffd

Browse files
authored
feat(curriculum): daily challenges 180-196 (freeCodeCamp#65687)
1 parent f176afe commit 2c98ffd

37 files changed

+5026
-1
lines changed

curriculum/challenges/english/blocks/daily-coding-challenges-javascript/697a49e6ff50d756c9b6935d.md

Lines changed: 677 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
id: 697a49e6ff50d756c9b6935e
3+
title: "Challenge 181: 2026 Winter Games Day 2: Snowboarding"
4+
challengeType: 28
5+
dashedName: challenge-181
6+
---
7+
8+
# --description--
9+
10+
Given a snowboarder's starting stance and a rotation in degrees, determine their landing stance.
11+
12+
- A snowboarder's stance is either `"Regular"` or `"Goofy"`.
13+
- Trick rotations are multiples of 90 degrees. Positive indicates clockwise rotation, and negative indicate counter-clockwise rotation.
14+
- The landing stance flips every 180 degrees of rotation.
15+
16+
For example, given `"Regular"` and `90`, return `"Regular"`. Given `"Regular"` and `180` degrees, return `"Goofy"`.
17+
18+
# --hints--
19+
20+
`getLandingStance("Regular", 90)` should return `"Regular"`.
21+
22+
```js
23+
assert.equal(getLandingStance("Regular", 90), "Regular");
24+
```
25+
26+
`getLandingStance("Regular", 180)` should return `"Goofy"`.
27+
28+
```js
29+
assert.equal(getLandingStance("Regular", 180), "Goofy");
30+
```
31+
32+
`getLandingStance("Goofy", -270)` should return `"Regular"`.
33+
34+
```js
35+
assert.equal(getLandingStance("Goofy", -270), "Regular");
36+
```
37+
38+
`getLandingStance("Regular", 2340)` should return `"Goofy"`.
39+
40+
```js
41+
assert.equal(getLandingStance("Regular", 2340), "Goofy");
42+
```
43+
44+
`getLandingStance("Goofy", 2160)` should return `"Goofy"`.
45+
46+
```js
47+
assert.equal(getLandingStance("Goofy", 2160), "Goofy");
48+
```
49+
50+
`getLandingStance("Goofy", -540)` should return `"Regular"`.
51+
52+
```js
53+
assert.equal(getLandingStance("Goofy", -540), "Regular");
54+
```
55+
56+
# --seed--
57+
58+
## --seed-contents--
59+
60+
```js
61+
function getLandingStance(startStance, rotation) {
62+
63+
return startStance;
64+
}
65+
```
66+
67+
# --solutions--
68+
69+
```js
70+
function getLandingStance(startStance, rotation) {
71+
const flips = Math.floor(Math.abs(rotation) / 180);
72+
if (flips % 2 === 0) {
73+
return startStance;
74+
} else {
75+
return startStance === "Regular" ? "Goofy" : "Regular";
76+
}
77+
}
78+
```
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
id: 697a49e6ff50d756c9b6935f
3+
title: "Challenge 182: 2026 Winter Games Day 3: Biathlon"
4+
challengeType: 28
5+
dashedName: challenge-182
6+
---
7+
8+
# --description--
9+
10+
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.
11+
12+
- Each round consists of 5 targets.
13+
- Each missed target results in a 150 meter penalty loop.
14+
15+
# --hints--
16+
17+
`calculatePenaltyDistance([4, 4])` should return `300`.
18+
19+
```js
20+
assert.equal(calculatePenaltyDistance([4, 4]), 300);
21+
```
22+
23+
`calculatePenaltyDistance([5, 5])` should return `0`.
24+
25+
```js
26+
assert.equal(calculatePenaltyDistance([5, 5]), 0);
27+
```
28+
29+
`calculatePenaltyDistance([4, 5, 3, 5])` should return `450`.
30+
31+
```js
32+
assert.equal(calculatePenaltyDistance([4, 5, 3, 5]), 450);
33+
```
34+
35+
`calculatePenaltyDistance([5, 4, 5, 5])` should return `150`.
36+
37+
```js
38+
assert.equal(calculatePenaltyDistance([5, 4, 5, 5]), 150);
39+
```
40+
41+
`calculatePenaltyDistance([4, 3, 0, 3])` should return `1500`.
42+
43+
```js
44+
assert.equal(calculatePenaltyDistance([4, 3, 0, 3]), 1500);
45+
```
46+
47+
# --seed--
48+
49+
## --seed-contents--
50+
51+
```js
52+
function calculatePenaltyDistance(rounds) {
53+
54+
return rounds;
55+
}
56+
```
57+
58+
# --solutions--
59+
60+
```js
61+
function calculatePenaltyDistance(rounds) {
62+
let totalPenalty = 0;
63+
64+
for (const hits of rounds) {
65+
const misses = 5 - hits;
66+
totalPenalty += misses * 150;
67+
}
68+
69+
return totalPenalty;
70+
}
71+
```
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
---
2+
id: 697a49e6ff50d756c9b69360
3+
title: "Challenge 183: 2026 Winter Games Day 4: Ski Jumping"
4+
challengeType: 28
5+
dashedName: challenge-183
6+
---
7+
8+
# --description--
9+
10+
Given distance points, style points, a wind compensation value, and K-point bonus value, calculate your score for the ski jump and determine if you won a medal or not.
11+
12+
- Your score is calculated by summing the above four values.
13+
14+
The current total scores of the other jumpers are:
15+
16+
```sh
17+
165.5
18+
172.0
19+
158.0
20+
180.0
21+
169.5
22+
175.0
23+
162.0
24+
170.0
25+
```
26+
27+
- If your score is the best, return `"Gold"`
28+
- If it's second best, return `"Silver"`
29+
- If it's third best, return `"Bronze"`
30+
- Otherwise, return `"No Medal"`
31+
32+
# --hints--
33+
34+
`skiJumpMedal(125.0, 58.0, 0.0, 6.0)` should return `"Gold"`.
35+
36+
```js
37+
assert.equal(skiJumpMedal(125.0, 58.0, 0.0, 6.0), "Gold");
38+
```
39+
40+
`skiJumpMedal(119.0, 50.0, 1.0, 4.0)` should return `"Bronze"`.
41+
42+
```js
43+
assert.equal(skiJumpMedal(119.0, 50.0, 1.0, 4.0), "Bronze");
44+
```
45+
46+
`skiJumpMedal(122.0, 52.0, -1.0, 4.0)` should return `"Silver"`.
47+
48+
```js
49+
assert.equal(skiJumpMedal(122.0, 52.0, -1.0, 4.0), "Silver");
50+
```
51+
52+
`skiJumpMedal(118.0, 50.5, -1.5, 4.0)` should return `"No Medal"`.
53+
54+
```js
55+
assert.equal(skiJumpMedal(118.0, 50.5, -1.5, 4.0), "No Medal");
56+
```
57+
58+
`skiJumpMedal(124.0, 50.5, 2.0, 5.0)` should return `"Gold"`.
59+
60+
```js
61+
assert.equal(skiJumpMedal(124.0, 50.5, 2.0, 5.0), "Gold");
62+
```
63+
64+
`skiJumpMedal(119.0, 49.5, 0.0, 3.0)` should return `"No Medal"`.
65+
66+
```js
67+
assert.equal(skiJumpMedal(119.0, 49.5, 0.0, 3.0), "No Medal");
68+
```
69+
70+
# --seed--
71+
72+
## --seed-contents--
73+
74+
```js
75+
function skiJumpMedal(distancePoints, stylePoints, windComp, kPointBonus) {
76+
77+
return distancePoints;
78+
}
79+
```
80+
81+
# --solutions--
82+
83+
```js
84+
function skiJumpMedal(distancePoints, stylePoints, windComp, kPointBonus) {
85+
const myScore = distancePoints + stylePoints + windComp + kPointBonus;
86+
const otherScores = [165.5, 172.0, 158.0, 180.0, 169.5, 175.0, 162.0, 170.0];
87+
const allScores = [...otherScores, myScore];
88+
allScores.sort((a, b) => b - a);
89+
const rank = allScores.indexOf(myScore) + 1;
90+
91+
if (rank === 1) return "Gold";
92+
if (rank === 2) return "Silver";
93+
if (rank === 3) return "Bronze";
94+
return "No Medal";
95+
}
96+
```
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
id: 697a49e6ff50d756c9b69361
3+
title: "Challenge 184: 2026 Winter Games Day 5: Cross-Country Skiing"
4+
challengeType: 28
5+
dashedName: challenge-184
6+
---
7+
8+
# --description--
9+
10+
Given an array of finish times for a cross-country ski race, convert them into times behind the winner.
11+
12+
- Given times are strings in `"H:MM:SS"` format.
13+
- Given times will be in order from fastest to slowest.
14+
- The winners time (fastest time) should correspond to `"0"`.
15+
- Each other time should show the time behind the winner, in the format `"+M:SS"`.
16+
17+
For example, given `["1:25:32", "1:26:10", "1:27:05"]`, return `["0", "+0:38", "+1:33"]`.
18+
19+
# --hints--
20+
21+
`getRelativeResults(["1:25:32", "1:26:10", "1:27:05"])` should return `["0", "+0:38", "+1:33"]`.
22+
23+
```js
24+
assert.deepEqual(getRelativeResults(["1:25:32", "1:26:10", "1:27:05"]), ["0", "+0:38", "+1:33"]);
25+
```
26+
27+
`getRelativeResults(["1:00:01", "1:00:05", "1:00:10"])` should return `["0", "+0:04", "+0:09"]`.
28+
29+
```js
30+
assert.deepEqual(getRelativeResults(["1:00:01", "1:00:05", "1:00:10"]), ["0", "+0:04", "+0:09"]);
31+
```
32+
33+
`getRelativeResults(["1:10:06", "1:10:23", "1:10:48", "1:12:11"])` should return `["0", "+0:17", "+0:42", "+2:05"]`.
34+
35+
```js
36+
assert.deepEqual(getRelativeResults(["1:10:06", "1:10:23", "1:10:48", "1:12:11"]), ["0", "+0:17", "+0:42", "+2:05"]);
37+
```
38+
39+
`getRelativeResults(["0:49:13", "0:49:15", "0:50:14", "0:51:30", "0:51:58", "0:52:16", "0:53:12", "0:53:31", "0:56:19", "1:02:20"])` should return `["0", "+0:02", "+1:01", "+2:17", "+2:45", "+3:03", "+3:59", "+4:18", "+7:06", "+13:07"]`.
40+
41+
```js
42+
assert.deepEqual(getRelativeResults(["0:49:13", "0:49:15", "0:50:14", "0:51:30", "0:51:58", "0:52:16", "0:53:12", "0:53:31", "0:56:19", "1:02:20"]), ["0", "+0:02", "+1:01", "+2:17", "+2:45", "+3:03", "+3:59", "+4:18", "+7:06", "+13:07"]);
43+
```
44+
45+
`getRelativeResults(["2:01:15", "2:10:45", "2:10:53", "2:11:04", "2:11:55", "2:13:27", "2:14:30", "2:15:10"])` should return `["0", "+9:30", "+9:38", "+9:49", "+10:40", "+12:12", "+13:15", "+13:55"]`.
46+
47+
```js
48+
assert.deepEqual(getRelativeResults(["2:01:15", "2:10:45", "2:10:53", "2:11:04", "2:11:55", "2:13:27", "2:14:30", "2:15:10"]), ["0", "+9:30", "+9:38", "+9:49", "+10:40", "+12:12", "+13:15", "+13:55"]);
49+
```
50+
51+
# --seed--
52+
53+
## --seed-contents--
54+
55+
```js
56+
function getRelativeResults(results) {
57+
58+
return results;
59+
}
60+
```
61+
62+
# --solutions--
63+
64+
```js
65+
function getRelativeResults(results) {
66+
const timeToSeconds = (timeStr) => {
67+
const [hours, minutes, seconds] = timeStr.split(':').map(Number);
68+
return hours * 3600 + minutes * 60 + seconds;
69+
};
70+
71+
const secondsToTimeFormat = (secs) => {
72+
const mins = Math.floor(secs / 60);
73+
const secsRemainder = secs % 60;
74+
return `+${mins}:${String(secsRemainder).padStart(2, '0')}`;
75+
};
76+
77+
const winnerSeconds = timeToSeconds(results[0]);
78+
79+
return results.map((time, index) => {
80+
if (index === 0) return '0';
81+
const currentSeconds = timeToSeconds(time);
82+
const difference = currentSeconds - winnerSeconds;
83+
return secondsToTimeFormat(difference);
84+
});
85+
}
86+
```

0 commit comments

Comments
 (0)