feat(curriculum): daily challenges 180-196 (#65687)

This commit is contained in:
Tom
2026-02-04 09:16:26 -06:00
committed by GitHub
parent f176afee34
commit 2c98ffd3b3
37 changed files with 5026 additions and 1 deletions

View File

@@ -0,0 +1,677 @@
---
id: 697a49e6ff50d756c9b6935d
title: "Challenge 180: 2026 Winter Games Day 1: Opening Day"
challengeType: 28
dashedName: challenge-180
---
# --description--
Today marks the start of the 2026 Winter Games. The next 17 days will bring you coding challenges inspired by them.
For the first one, you are given a two-letter country code and need to return the flag emoji for that country.
Use this list:
| Country | Code | Flag |
| - | -: | :--: |
| Albania | `"AL"` | `"🇦🇱"` |
| Andorra | `"AD"` | `"🇦🇩"` |
| Argentina | `"AR"` | `"🇦🇷"` |
| Armenia | `"AM"` | `"🇦🇲"` |
| Australia | `"AU"` | `"🇦🇺"` |
| Austria | `"AT"` | `"🇦🇹"` |
| Azerbaijan | `"AZ"` | `"🇦🇿"` |
| Belgium | `"BE"` | `"🇧🇪"` |
| Benin | `"BJ"` | `"🇧🇯"` |
| Bolivia | `"BO"` | `"🇧🇴"` |
| Bosnia and Herzegovina | `"BA"` | `"🇧🇦"` |
| Brazil | `"BR"` | `"🇧🇷"` |
| Bulgaria | `"BG"` | `"🇧🇬"` |
| Canada | `"CA"` | `"🇨🇦"` |
| Chile | `"CL"` | `"🇨🇱"` |
| China | `"CN"` | `"🇨🇳"` |
| Colombia | `"CO"` | `"🇨🇴"` |
| Croatia | `"HR"` | `"🇭🇷"` |
| Cyprus | `"CY"` | `"🇨🇾"` |
| Czech Republic | `"CZ"` | `"🇨🇿"` |
| Denmark | `"DK"` | `"🇩🇰"` |
| Ecuador | `"EC"` | `"🇪🇨"` |
| Eritrea | `"ER"` | `"🇪🇷"` |
| Estonia | `"EE"` | `"🇪🇪"` |
| Finland | `"FI"` | `"🇫🇮"` |
| France | `"FR"` | `"🇫🇷"` |
| Georgia | `"GE"` | `"🇬🇪"` |
| Germany | `"DE"` | `"🇩🇪"` |
| Great Britain | `"GB"` | `"🇬🇧"` |
| Greece | `"GR"` | `"🇬🇷"` |
| Guinea-Bissau | `"GW"` | `"🇬🇼"` |
| Haiti | `"HT"` | `"🇭🇹"` |
| Hong Kong | `"HK"` | `"🇭🇰"` |
| Hungary | `"HU"` | `"🇭🇺"` |
| Iceland | `"IS"` | `"🇮🇸"` |
| India | `"IN"` | `"🇮🇳"` |
| Iran | `"IR"` | `"🇮🇷"` |
| Ireland | `"IE"` | `"🇮🇪"` |
| Israel | `"IL"` | `"🇮🇱"` |
| Italy | `"IT"` | `"🇮🇹"` |
| Jamaica | `"JM"` | `"🇯🇲"` |
| Japan | `"JP"` | `"🇯🇵"` |
| Kazakhstan | `"KZ"` | `"🇰🇿"` |
| Kenya | `"KE"` | `"🇰🇪"` |
| Kosovo | `"XK"` | `"🇽🇰"` |
| Kyrgyzstan | `"KG"` | `"🇰🇬"` |
| Latvia | `"LV"` | `"🇱🇻"` |
| Lebanon | `"LB"` | `"🇱🇧"` |
| Liechtenstein | `"LI"` | `"🇱🇮"` |
| Lithuania | `"LT"` | `"🇱🇹"` |
| Luxembourg | `"LU"` | `"🇱🇺"` |
| Madagascar | `"MG"` | `"🇲🇬"` |
| Malaysia | `"MY"` | `"🇲🇾"` |
| Malta | `"MT"` | `"🇲🇹"` |
| Mexico | `"MX"` | `"🇲🇽"` |
| Moldova | `"MD"` | `"🇲🇩"` |
| Monaco | `"MC"` | `"🇲🇨"` |
| Mongolia | `"MN"` | `"🇲🇳"` |
| Montenegro | `"ME"` | `"🇲🇪"` |
| Morocco | `"MA"` | `"🇲🇦"` |
| Netherlands | `"NL"` | `"🇳🇱"` |
| New Zealand | `"NZ"` | `"🇳🇿"` |
| Nigeria | `"NG"` | `"🇳🇬"` |
| North Macedonia | `"MK"` | `"🇲🇰"` |
| Norway | `"NO"` | `"🇳🇴"` |
| Pakistan | `"PK"` | `"🇵🇰"` |
| Philippines | `"PH"` | `"🇵🇭"` |
| Poland | `"PL"` | `"🇵🇱"` |
| Portugal | `"PT"` | `"🇵🇹"` |
| Puerto Rico | `"PR"` | `"🇵🇷"` |
| Romania | `"RO"` | `"🇷🇴"` |
| San Marino | `"SM"` | `"🇸🇲"` |
| Saudi Arabia | `"SA"` | `"🇸🇦"` |
| Serbia | `"RS"` | `"🇷🇸"` |
| Singapore | `"SG"` | `"🇸🇬"` |
| Slovakia | `"SK"` | `"🇸🇰"` |
| Slovenia | `"SI"` | `"🇸🇮"` |
| South Africa | `"ZA"` | `"🇿🇦"` |
| South Korea | `"KR"` | `"🇰🇷"` |
| Spain | `"ES"` | `"🇪🇸"` |
| Sweden | `"SE"` | `"🇸🇪"` |
| Switzerland | `"CH"` | `"🇨🇭"` |
| Thailand | `"TH"` | `"🇹🇭"` |
| Trinidad & Tobago | `"TT"` | `"🇹🇹"` |
| Turkey | `"TR"` | `"🇹🇷"` |
| Ukraine | `"UA"` | `"🇺🇦"` |
| United Arab Emirates | `"AE"` | `"🇦🇪"` |
| United States | `"US"` | `"🇺🇸"` |
| Uruguay | `"UY"` | `"🇺🇾"` |
| Uzbekistan | `"UZ"` | `"🇺🇿"` |
| Venezuela | `"VE"` | `"🇻🇪"` |
# --hints--
`getFlag("AL")` should return `"🇦🇱"`.
```js
assert.equal(getFlag("AL"), "🇦🇱");
```
`getFlag("AD")` should return `"🇦🇩"`.
```js
assert.equal(getFlag("AD"), "🇦🇩");
```
`getFlag("AR")` should return `"🇦🇷"`.
```js
assert.equal(getFlag("AR"), "🇦🇷")
```
`getFlag("AM")` should return `"🇦🇲"`.
```js
assert.equal(getFlag("AM"), "🇦🇲")
```
`getFlag("AU")` should return `"🇦🇺"`.
```js
assert.equal(getFlag("AU"), "🇦🇺")
```
`getFlag("AT")` should return `"🇦🇹"`.
```js
assert.equal(getFlag("AT"), "🇦🇹")
```
`getFlag("AZ")` should return `"🇦🇿"`.
```js
assert.equal(getFlag("AZ"), "🇦🇿")
```
`getFlag("BE")` should return `"🇧🇪"`.
```js
assert.equal(getFlag("BE"), "🇧🇪")
```
`getFlag("BJ")` should return `"🇧🇯"`.
```js
assert.equal(getFlag("BJ"), "🇧🇯")
```
`getFlag("BO")` should return `"🇧🇴"`.
```js
assert.equal(getFlag("BO"), "🇧🇴")
```
`getFlag("BA")` should return `"🇧🇦"`.
```js
assert.equal(getFlag("BA"), "🇧🇦")
```
`getFlag("BR")` should return `"🇧🇷"`.
```js
assert.equal(getFlag("BR"), "🇧🇷")
```
`getFlag("BG")` should return `"🇧🇬"`.
```js
assert.equal(getFlag("BG"), "🇧🇬")
```
`getFlag("CA")` should return `"🇨🇦"`.
```js
assert.equal(getFlag("CA"), "🇨🇦")
```
`getFlag("CL")` should return `"🇨🇱"`.
```js
assert.equal(getFlag("CL"), "🇨🇱")
```
`getFlag("CN")` should return `"🇨🇳"`.
```js
assert.equal(getFlag("CN"), "🇨🇳")
```
`getFlag("CO")` should return `"🇨🇴"`.
```js
assert.equal(getFlag("CO"), "🇨🇴")
```
`getFlag("HR")` should return `"🇭🇷"`.
```js
assert.equal(getFlag("HR"), "🇭🇷")
```
`getFlag("CY")` should return `"🇨🇾"`.
```js
assert.equal(getFlag("CY"), "🇨🇾")
```
`getFlag("CZ")` should return `"🇨🇿"`.
```js
assert.equal(getFlag("CZ"), "🇨🇿")
```
`getFlag("DK")` should return `"🇩🇰"`.
```js
assert.equal(getFlag("DK"), "🇩🇰")
```
`getFlag("EC")` should return `"🇪🇨"`.
```js
assert.equal(getFlag("EC"), "🇪🇨")
```
`getFlag("ER")` should return `"🇪🇷"`.
```js
assert.equal(getFlag("ER"), "🇪🇷")
```
`getFlag("EE")` should return `"🇪🇪"`.
```js
assert.equal(getFlag("EE"), "🇪🇪")
```
`getFlag("FI")` should return `"🇫🇮"`.
```js
assert.equal(getFlag("FI"), "🇫🇮")
```
`getFlag("FR")` should return `"🇫🇷"`.
```js
assert.equal(getFlag("FR"), "🇫🇷")
```
`getFlag("GE")` should return `"🇬🇪"`.
```js
assert.equal(getFlag("GE"), "🇬🇪")
```
`getFlag("DE")` should return `"🇩🇪"`.
```js
assert.equal(getFlag("DE"), "🇩🇪")
```
`getFlag("GB")` should return `"🇬🇧"`.
```js
assert.equal(getFlag("GB"), "🇬🇧")
```
`getFlag("GR")` should return `"🇬🇷"`.
```js
assert.equal(getFlag("GR"), "🇬🇷")
```
`getFlag("GW")` should return `"🇬🇼"`.
```js
assert.equal(getFlag("GW"), "🇬🇼")
```
`getFlag("HT")` should return `"🇭🇹"`.
```js
assert.equal(getFlag("HT"), "🇭🇹")
```
`getFlag("HK")` should return `"🇭🇰"`.
```js
assert.equal(getFlag("HK"), "🇭🇰")
```
`getFlag("HU")` should return `"🇭🇺"`.
```js
assert.equal(getFlag("HU"), "🇭🇺")
```
`getFlag("IS")` should return `"🇮🇸"`.
```js
assert.equal(getFlag("IS"), "🇮🇸")
```
`getFlag("IN")` should return `"🇮🇳"`.
```js
assert.equal(getFlag("IN"), "🇮🇳")
```
`getFlag("IR")` should return `"🇮🇷"`.
```js
assert.equal(getFlag("IR"), "🇮🇷")
```
`getFlag("IE")` should return `"🇮🇪"`.
```js
assert.equal(getFlag("IE"), "🇮🇪")
```
`getFlag("IL")` should return `"🇮🇱"`.
```js
assert.equal(getFlag("IL"), "🇮🇱")
```
`getFlag("IT")` should return `"🇮🇹"`.
```js
assert.equal(getFlag("IT"), "🇮🇹")
```
`getFlag("JM")` should return `"🇯🇲"`.
```js
assert.equal(getFlag("JM"), "🇯🇲")
```
`getFlag("JP")` should return `"🇯🇵"`.
```js
assert.equal(getFlag("JP"), "🇯🇵")
```
`getFlag("KZ")` should return `"🇰🇿"`.
```js
assert.equal(getFlag("KZ"), "🇰🇿")
```
`getFlag("KE")` should return `"🇰🇪"`.
```js
assert.equal(getFlag("KE"), "🇰🇪")
```
`getFlag("XK")` should return `"🇽🇰"`.
```js
assert.equal(getFlag("XK"), "🇽🇰")
```
`getFlag("KG")` should return `"🇰🇬"`.
```js
assert.equal(getFlag("KG"), "🇰🇬")
```
`getFlag("LV")` should return `"🇱🇻"`.
```js
assert.equal(getFlag("LV"), "🇱🇻")
```
`getFlag("LB")` should return `"🇱🇧"`.
```js
assert.equal(getFlag("LB"), "🇱🇧")
```
`getFlag("LI")` should return `"🇱🇮"`.
```js
assert.equal(getFlag("LI"), "🇱🇮")
```
`getFlag("LT")` should return `"🇱🇹"`.
```js
assert.equal(getFlag("LT"), "🇱🇹")
```
`getFlag("LU")` should return `"🇱🇺"`.
```js
assert.equal(getFlag("LU"), "🇱🇺")
```
`getFlag("MG")` should return `"🇲🇬"`.
```js
assert.equal(getFlag("MG"), "🇲🇬")
```
`getFlag("MY")` should return `"🇲🇾"`.
```js
assert.equal(getFlag("MY"), "🇲🇾")
```
`getFlag("MT")` should return `"🇲🇹"`.
```js
assert.equal(getFlag("MT"), "🇲🇹")
```
`getFlag("MX")` should return `"🇲🇽"`.
```js
assert.equal(getFlag("MX"), "🇲🇽")
```
`getFlag("MD")` should return `"🇲🇩"`.
```js
assert.equal(getFlag("MD"), "🇲🇩")
```
`getFlag("MC")` should return `"🇲🇨"`.
```js
assert.equal(getFlag("MC"), "🇲🇨")
```
`getFlag("MN")` should return `"🇲🇳"`.
```js
assert.equal(getFlag("MN"), "🇲🇳")
```
`getFlag("ME")` should return `"🇲🇪"`.
```js
assert.equal(getFlag("ME"), "🇲🇪")
```
`getFlag("MA")` should return `"🇲🇦"`.
```js
assert.equal(getFlag("MA"), "🇲🇦")
```
`getFlag("NL")` should return `"🇳🇱"`.
```js
assert.equal(getFlag("NL"), "🇳🇱")
```
`getFlag("NZ")` should return `"🇳🇿"`.
```js
assert.equal(getFlag("NZ"), "🇳🇿")
```
`getFlag("NG")` should return `"🇳🇬"`.
```js
assert.equal(getFlag("NG"), "🇳🇬")
```
`getFlag("MK")` should return `"🇲🇰"`.
```js
assert.equal(getFlag("MK"), "🇲🇰")
```
`getFlag("NO")` should return `"🇳🇴"`.
```js
assert.equal(getFlag("NO"), "🇳🇴")
```
`getFlag("PK")` should return `"🇵🇰"`.
```js
assert.equal(getFlag("PK"), "🇵🇰")
```
`getFlag("PH")` should return `"🇵🇭"`.
```js
assert.equal(getFlag("PH"), "🇵🇭")
```
`getFlag("PL")` should return `"🇵🇱"`.
```js
assert.equal(getFlag("PL"), "🇵🇱")
```
`getFlag("PT")` should return `"🇵🇹"`.
```js
assert.equal(getFlag("PT"), "🇵🇹")
```
`getFlag("PR")` should return `"🇵🇷"`.
```js
assert.equal(getFlag("PR"), "🇵🇷")
```
`getFlag("RO")` should return `"🇷🇴"`.
```js
assert.equal(getFlag("RO"), "🇷🇴")
```
`getFlag("SM")` should return `"🇸🇲"`.
```js
assert.equal(getFlag("SM"), "🇸🇲")
```
`getFlag("SA")` should return `"🇸🇦"`.
```js
assert.equal(getFlag("SA"), "🇸🇦")
```
`getFlag("RS")` should return `"🇷🇸"`.
```js
assert.equal(getFlag("RS"), "🇷🇸")
```
`getFlag("SG")` should return `"🇸🇬"`.
```js
assert.equal(getFlag("SG"), "🇸🇬")
```
`getFlag("SK")` should return `"🇸🇰"`.
```js
assert.equal(getFlag("SK"), "🇸🇰")
```
`getFlag("SI")` should return `"🇸🇮"`.
```js
assert.equal(getFlag("SI"), "🇸🇮")
```
`getFlag("ZA")` should return `"🇿🇦"`.
```js
assert.equal(getFlag("ZA"), "🇿🇦")
```
`getFlag("KR")` should return `"🇰🇷"`.
```js
assert.equal(getFlag("KR"), "🇰🇷")
```
`getFlag("ES")` should return `"🇪🇸"`.
```js
assert.equal(getFlag("ES"), "🇪🇸")
```
`getFlag("SE")` should return `"🇸🇪"`.
```js
assert.equal(getFlag("SE"), "🇸🇪")
```
`getFlag("CH")` should return `"🇨🇭"`.
```js
assert.equal(getFlag("CH"), "🇨🇭")
```
`getFlag("TH")` should return `"🇹🇭"`.
```js
assert.equal(getFlag("TH"), "🇹🇭")
```
`getFlag("TT")` should return `"🇹🇹"`.
```js
assert.equal(getFlag("TT"), "🇹🇹")
```
`getFlag("TR")` should return `"🇹🇷"`.
```js
assert.equal(getFlag("TR"), "🇹🇷")
```
`getFlag("UA")` should return `"🇺🇦"`.
```js
assert.equal(getFlag("UA"), "🇺🇦")
```
`getFlag("AE")` should return `"🇦🇪"`.
```js
assert.equal(getFlag("AE"), "🇦🇪")
```
`getFlag("US")` should return `"🇺🇸"`.
```js
assert.equal(getFlag("US"), "🇺🇸")
```
`getFlag("UY")` should return `"🇺🇾"`.
```js
assert.equal(getFlag("UY"), "🇺🇾")
```
`getFlag("UZ")` should return `"🇺🇿"`.
```js
assert.equal(getFlag("UZ"), "🇺🇿")
```
`getFlag("VE")` should return `"🇻🇪"`.
```js
assert.equal(getFlag("VE"), "🇻🇪")
```
# --seed--
## --seed-contents--
```js
function getFlag(code) {
return code;
}
```
# --solutions--
```js
function getFlag(code) {
return [...code]
.map(char => String.fromCodePoint(127397 + char.charCodeAt()))
.join("");
}
```

View File

@@ -0,0 +1,78 @@
---
id: 697a49e6ff50d756c9b6935e
title: "Challenge 181: 2026 Winter Games Day 2: Snowboarding"
challengeType: 28
dashedName: challenge-181
---
# --description--
Given a snowboarder's starting stance and a rotation in degrees, determine their landing stance.
- A snowboarder's stance is either `"Regular"` or `"Goofy"`.
- Trick rotations are multiples of 90 degrees. Positive indicates clockwise rotation, and negative indicate counter-clockwise rotation.
- The landing stance flips every 180 degrees of rotation.
For example, given `"Regular"` and `90`, return `"Regular"`. Given `"Regular"` and `180` degrees, return `"Goofy"`.
# --hints--
`getLandingStance("Regular", 90)` should return `"Regular"`.
```js
assert.equal(getLandingStance("Regular", 90), "Regular");
```
`getLandingStance("Regular", 180)` should return `"Goofy"`.
```js
assert.equal(getLandingStance("Regular", 180), "Goofy");
```
`getLandingStance("Goofy", -270)` should return `"Regular"`.
```js
assert.equal(getLandingStance("Goofy", -270), "Regular");
```
`getLandingStance("Regular", 2340)` should return `"Goofy"`.
```js
assert.equal(getLandingStance("Regular", 2340), "Goofy");
```
`getLandingStance("Goofy", 2160)` should return `"Goofy"`.
```js
assert.equal(getLandingStance("Goofy", 2160), "Goofy");
```
`getLandingStance("Goofy", -540)` should return `"Regular"`.
```js
assert.equal(getLandingStance("Goofy", -540), "Regular");
```
# --seed--
## --seed-contents--
```js
function getLandingStance(startStance, rotation) {
return startStance;
}
```
# --solutions--
```js
function getLandingStance(startStance, rotation) {
const flips = Math.floor(Math.abs(rotation) / 180);
if (flips % 2 === 0) {
return startStance;
} else {
return startStance === "Regular" ? "Goofy" : "Regular";
}
}
```

View File

@@ -0,0 +1,71 @@
---
id: 697a49e6ff50d756c9b6935f
title: "Challenge 182: 2026 Winter Games Day 3: Biathlon"
challengeType: 28
dashedName: 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`.
```js
assert.equal(calculatePenaltyDistance([4, 4]), 300);
```
`calculatePenaltyDistance([5, 5])` should return `0`.
```js
assert.equal(calculatePenaltyDistance([5, 5]), 0);
```
`calculatePenaltyDistance([4, 5, 3, 5])` should return `450`.
```js
assert.equal(calculatePenaltyDistance([4, 5, 3, 5]), 450);
```
`calculatePenaltyDistance([5, 4, 5, 5])` should return `150`.
```js
assert.equal(calculatePenaltyDistance([5, 4, 5, 5]), 150);
```
`calculatePenaltyDistance([4, 3, 0, 3])` should return `1500`.
```js
assert.equal(calculatePenaltyDistance([4, 3, 0, 3]), 1500);
```
# --seed--
## --seed-contents--
```js
function calculatePenaltyDistance(rounds) {
return rounds;
}
```
# --solutions--
```js
function calculatePenaltyDistance(rounds) {
let totalPenalty = 0;
for (const hits of rounds) {
const misses = 5 - hits;
totalPenalty += misses * 150;
}
return totalPenalty;
}
```

View File

@@ -0,0 +1,96 @@
---
id: 697a49e6ff50d756c9b69360
title: "Challenge 183: 2026 Winter Games Day 4: Ski Jumping"
challengeType: 28
dashedName: challenge-183
---
# --description--
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.
- Your score is calculated by summing the above four values.
The current total scores of the other jumpers are:
```sh
165.5
172.0
158.0
180.0
169.5
175.0
162.0
170.0
```
- If your score is the best, return `"Gold"`
- If it's second best, return `"Silver"`
- If it's third best, return `"Bronze"`
- Otherwise, return `"No Medal"`
# --hints--
`skiJumpMedal(125.0, 58.0, 0.0, 6.0)` should return `"Gold"`.
```js
assert.equal(skiJumpMedal(125.0, 58.0, 0.0, 6.0), "Gold");
```
`skiJumpMedal(119.0, 50.0, 1.0, 4.0)` should return `"Bronze"`.
```js
assert.equal(skiJumpMedal(119.0, 50.0, 1.0, 4.0), "Bronze");
```
`skiJumpMedal(122.0, 52.0, -1.0, 4.0)` should return `"Silver"`.
```js
assert.equal(skiJumpMedal(122.0, 52.0, -1.0, 4.0), "Silver");
```
`skiJumpMedal(118.0, 50.5, -1.5, 4.0)` should return `"No Medal"`.
```js
assert.equal(skiJumpMedal(118.0, 50.5, -1.5, 4.0), "No Medal");
```
`skiJumpMedal(124.0, 50.5, 2.0, 5.0)` should return `"Gold"`.
```js
assert.equal(skiJumpMedal(124.0, 50.5, 2.0, 5.0), "Gold");
```
`skiJumpMedal(119.0, 49.5, 0.0, 3.0)` should return `"No Medal"`.
```js
assert.equal(skiJumpMedal(119.0, 49.5, 0.0, 3.0), "No Medal");
```
# --seed--
## --seed-contents--
```js
function skiJumpMedal(distancePoints, stylePoints, windComp, kPointBonus) {
return distancePoints;
}
```
# --solutions--
```js
function skiJumpMedal(distancePoints, stylePoints, windComp, kPointBonus) {
const myScore = distancePoints + stylePoints + windComp + kPointBonus;
const otherScores = [165.5, 172.0, 158.0, 180.0, 169.5, 175.0, 162.0, 170.0];
const allScores = [...otherScores, myScore];
allScores.sort((a, b) => b - a);
const rank = allScores.indexOf(myScore) + 1;
if (rank === 1) return "Gold";
if (rank === 2) return "Silver";
if (rank === 3) return "Bronze";
return "No Medal";
}
```

View File

@@ -0,0 +1,86 @@
---
id: 697a49e6ff50d756c9b69361
title: "Challenge 184: 2026 Winter Games Day 5: Cross-Country Skiing"
challengeType: 28
dashedName: challenge-184
---
# --description--
Given an array of finish times for a cross-country ski race, convert them into times behind the winner.
- Given times are strings in `"H:MM:SS"` format.
- Given times will be in order from fastest to slowest.
- The winners time (fastest time) should correspond to `"0"`.
- Each other time should show the time behind the winner, in the format `"+M:SS"`.
For example, given `["1:25:32", "1:26:10", "1:27:05"]`, return `["0", "+0:38", "+1:33"]`.
# --hints--
`getRelativeResults(["1:25:32", "1:26:10", "1:27:05"])` should return `["0", "+0:38", "+1:33"]`.
```js
assert.deepEqual(getRelativeResults(["1:25:32", "1:26:10", "1:27:05"]), ["0", "+0:38", "+1:33"]);
```
`getRelativeResults(["1:00:01", "1:00:05", "1:00:10"])` should return `["0", "+0:04", "+0:09"]`.
```js
assert.deepEqual(getRelativeResults(["1:00:01", "1:00:05", "1:00:10"]), ["0", "+0:04", "+0:09"]);
```
`getRelativeResults(["1:10:06", "1:10:23", "1:10:48", "1:12:11"])` should return `["0", "+0:17", "+0:42", "+2:05"]`.
```js
assert.deepEqual(getRelativeResults(["1:10:06", "1:10:23", "1:10:48", "1:12:11"]), ["0", "+0:17", "+0:42", "+2:05"]);
```
`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"]`.
```js
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"]);
```
`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"]`.
```js
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"]);
```
# --seed--
## --seed-contents--
```js
function getRelativeResults(results) {
return results;
}
```
# --solutions--
```js
function getRelativeResults(results) {
const timeToSeconds = (timeStr) => {
const [hours, minutes, seconds] = timeStr.split(':').map(Number);
return hours * 3600 + minutes * 60 + seconds;
};
const secondsToTimeFormat = (secs) => {
const mins = Math.floor(secs / 60);
const secsRemainder = secs % 60;
return `+${mins}:${String(secsRemainder).padStart(2, '0')}`;
};
const winnerSeconds = timeToSeconds(results[0]);
return results.map((time, index) => {
if (index === 0) return '0';
const currentSeconds = timeToSeconds(time);
const difference = currentSeconds - winnerSeconds;
return secondsToTimeFormat(difference);
});
}
```

View File

@@ -0,0 +1,69 @@
---
id: 697a49e6ff50d756c9b69362
title: "Challenge 185: 2026 Winter Games Day 6: Figure Skating"
challengeType: 28
dashedName: challenge-185
---
# --description--
Given an array of judge scores and optional penalties, calculate the final score for a figure skating routine.
The first argument is an array of 10 judge scores, each a number from 0 to 10. Remove the highest and lowest judge scores and sum the remaining 8 scores to get the base score.
Any additional arguments passed to the function are penalties. Subtract all penalties from the base score to get the final score.
# --hints--
`computeScore([10, 8, 9, 6, 9, 8, 8, 9, 7, 7], 1)` should return `64`.
```js
assert.equal(computeScore([10, 8, 9, 6, 9, 8, 8, 9, 7, 7], 1), 64);
```
`computeScore([10, 10, 10, 10, 10, 10, 10, 10, 10, 10])` should return `80`.
```js
assert.equal(computeScore([10, 10, 10, 10, 10, 10, 10, 10, 10, 10]), 80);
```
`computeScore([10, 8, 9, 10, 9, 8, 8, 9, 10, 7], 1, 2, 1)` should return `67`.
```js
assert.equal(computeScore([10, 8, 9, 10, 9, 8, 8, 9, 10, 7], 1, 2, 1), 67);
```
`computeScore([8.0, 8.5, 9.0, 8.5, 9.0, 8.0, 9.0, 8.5, 9.0, 8.5], 0.5, 1.0)` should return `67.5`.
```js
assert.equal(computeScore([8.0, 8.5, 9.0, 8.5, 9.0, 8.0, 9.0, 8.5, 9.0, 8.5], 0.5, 1.0), 67.5);
```
`computeScore([6.0, 8.5, 7.0, 9.0, 7.5, 8.0, 6.5, 9.5, 7.0, 8.0], 1.5, 0.5, 0.5)` should return `59`.
```js
assert.equal(computeScore([6.0, 8.5, 7.0, 9.0, 7.5, 8.0, 6.5, 9.5, 7.0, 8.0], 1.5, 0.5, 0.5), 59);
```
# --seed--
## --seed-contents--
```js
function computeScore(judgeScores, ...penalties) {
return judgeScores;
}
```
# --solutions--
```js
function computeScore(judgeScores, ...penalties) {
const sortedScores = [...judgeScores].sort((a, b) => a - b);
const baseScore = sortedScores.slice(1, 9).reduce((sum, s) => sum + s, 0);
const totalPenalty = penalties.reduce((sum, p) => sum + p, 0);
return baseScore - totalPenalty;
}
```

View File

@@ -0,0 +1,74 @@
---
id: 697a49e6ff50d756c9b69363
title: "Challenge 186: 2026 Winter Games Day 7: Speed Skating"
challengeType: 28
dashedName: challenge-186
---
# --description--
Given two arrays representing the lap times (in seconds) for two speed skaters, return the lap number where the difference in lap times is the largest.
The first element of each array corresponds to lap 1, the second to lap 2, and so on.
# --hints--
`largestDifference([26.11, 25.80, 25.92, 26.23, 26.07], [25.93, 25.74, 26.53, 26.11, 26.30])` should return `3`.
```js
assert.equal(largestDifference([26.11, 25.80, 25.92, 26.23, 26.07], [25.93, 25.74, 26.53, 26.11, 26.30]), 3);
```
`largestDifference([27.04, 25.94, 26.22, 26.07, 26.18], [25.59, 25.80, 26.11, 26.01, 26.23])` should return `1`.
```js
assert.equal(largestDifference([27.04, 25.94, 26.22, 26.07, 26.18], [25.59, 25.80, 26.11, 26.01, 26.23]), 1);
```
`largestDifference([25.82, 25.90, 26.05, 26.00, 26.48], [25.85, 25.92, 26.07, 25.98, 25.95])` should return `5`.
```js
assert.equal(largestDifference([25.82, 25.90, 26.05, 26.00, 26.48], [25.85, 25.92, 26.07, 25.98, 25.95]), 5);
```
`largestDifference([25.88, 26.10, 25.95, 26.05, 26.00], [25.90, 26.55, 25.92, 26.03, 26.01])` should return `2`.
```js
assert.equal(largestDifference([25.88, 26.10, 25.95, 26.05, 26.00], [25.90, 26.55, 25.92, 26.03, 26.01]), 2);
```
`largestDifference([25.92, 26.01, 26.05, 25.88, 26.12], [25.95, 26.00, 26.03, 26.45, 26.10])` should return `4`.
```js
assert.equal(largestDifference([25.92, 26.01, 26.05, 25.88, 26.12], [25.95, 26.00, 26.03, 26.45, 26.10]), 4);
```
# --seed--
## --seed-contents--
```js
function largestDifference(skater1, skater2) {
return skater1;
}
```
# --solutions--
```js
function largestDifference(skater1, skater2) {
let maxDiff = -1;
let lapNumber = 1;
for (let i = 0; i < skater1.length; i++) {
const diff = Math.abs(skater1[i] - skater2[i]);
if (diff > maxDiff) {
maxDiff = diff;
lapNumber = i + 1;
}
}
return lapNumber;
}
```

View File

@@ -0,0 +1,87 @@
---
id: 697a49e6ff50d756c9b69364
title: "Challenge 187: 2026 Winter Games Day 8: Luge"
challengeType: 28
dashedName: challenge-187
---
# --description--
Given an array of five numbers, each representing the time (in seconds) it took a luger to complete a segment of a track, determine which segment had the fastest speed and what that speed was.
The track is divided into the following segments:
- Segment 1: 320 meters
- Segment 2: 280 meters
- Segment 3: 350 meters
- Segment 4: 300 meters
- Segment 5: 250 meters
The first value in the given array corresponds to the time for segment 1, the second value to segment 2, and so on.
To calculate the speed (in meters per second) for a segment, divide the distance by the time.
Return `"The luger's fastest speed was X m/s on segment Y."`. Where `X` is the fastest speed, rounded to two decimal places, and `Y` is the segment number where the fastest speed occurred.
# --hints--
`getFastestSpeed([9.523, 8.234, 10.012, 9.001, 7.128])` should return `"The luger's fastest speed was 35.07 m/s on segment 5."`
```js
assert.equal(getFastestSpeed([9.523, 8.234, 10.012, 9.001, 7.128]), "The luger's fastest speed was 35.07 m/s on segment 5.");
```
`getFastestSpeed([9.381, 7.417, 9.912, 8.815, 7.284])` should return `"The luger's fastest speed was 37.75 m/s on segment 2."`
```js
assert.equal(getFastestSpeed([9.381, 7.417, 9.912, 8.815, 7.284]), "The luger's fastest speed was 37.75 m/s on segment 2.");
```
`getFastestSpeed([8.890, 7.601, 9.093, 8.392, 6.912])` should return `"The luger's fastest speed was 38.49 m/s on segment 3."`
```js
assert.equal(getFastestSpeed([8.890, 7.601, 9.093, 8.392, 6.912]), "The luger's fastest speed was 38.49 m/s on segment 3.");
```
`getFastestSpeed([8.490, 7.732, 10.103, 8.489, 6.840])` should return `"The luger's fastest speed was 37.69 m/s on segment 1."`
```js
assert.equal(getFastestSpeed([8.490, 7.732, 10.103, 8.489, 6.840]), "The luger's fastest speed was 37.69 m/s on segment 1.");
```
`getFastestSpeed([8.204, 7.230, 9.673, 7.645, 6.508])` should return `"The luger's fastest speed was 39.24 m/s on segment 4."`
```js
assert.equal(getFastestSpeed([8.204, 7.230, 9.673, 7.645, 6.508]), "The luger's fastest speed was 39.24 m/s on segment 4.");
```
# --seed--
## --seed-contents--
```js
function getFastestSpeed(times) {
return times;
}
```
# --solutions--
```js
function getFastestSpeed(times) {
const distances = [320, 280, 350, 300, 250];
let fastestSpeed = 0;
let fastestSegment = 0;
for (let i = 0; i < times.length; i++) {
const speed = distances[i] / times[i];
if (speed > fastestSpeed) {
fastestSpeed = speed;
fastestSegment = i + 1;
}
}
return `The luger's fastest speed was ${fastestSpeed.toFixed(2)} m/s on segment ${fastestSegment}.`;
}
```

View File

@@ -0,0 +1,103 @@
---
id: 697a49e6ff50d756c9b69365
title: "Challenge 188: 2026 Winter Games Day 9: Skeleton"
challengeType: 28
dashedName: challenge-188
---
# --description--
Given a string representing the curves on a skeleton track, determine the difficulty of the track.
- The given string will only consist of the letters:
- `"L"` for a left turn
- `"R"` for a right turn
- `"S"` for a straight segment
- Each direction change adds 15 points (an `"L"` followed by an `"R"` or vice versa).
- All other curves add 5 points each (all other `"L"` or `"R"` characters).
- Straight segments add 0 points.
The difficulty of the track is based on the total score. Return:
- `"Easy"` if the total is 0 - 100
- `"Medium"` if the total is 101-200
- `"Hard"` if the total is over 200
# --hints--
`getDifficulty("SLSLLSRRLSRLRL")` should return `"Easy"`.
```js
assert.equal(getDifficulty("SLSLLSRRLSRLRL"), "Easy");
```
`getDifficulty("LLRSLRLRSLLRLRSLRRLRSRLLS")` should return `"Hard"`.
```js
assert.equal(getDifficulty("LLRSLRLRSLLRLRSLRRLRSRLLS"), "Hard");
```
`getDifficulty("SRRRRLSLLRLRSSRLSRL")` should return `"Medium"`.
```js
assert.equal(getDifficulty("SRRRRLSLLRLRSSRLSRL"), "Medium");
```
`getDifficulty("LSRLRLSRLRLSLRSLRLLRLSRLRLRSL")` should return `"Hard"`.
```js
assert.equal(getDifficulty("LSRLRLSRLRLSLRSLRLLRLSRLRLRSL"), "Hard");
```
`getDifficulty("SLLSSLRLSLSLRSLSSLRL")` should return `"Medium"`.
```js
assert.equal(getDifficulty("SLLSSLRLSLSLRSLSSLRL"), "Medium");
```
`getDifficulty("SRSLSRSLSRRSLSRSRSLSRLSRSR")` should return `"Easy"`.
```js
assert.equal(getDifficulty("SRSLSRSLSRRSLSRSRSLSRLSRSR"), "Easy");
```
# --seed--
## --seed-contents--
```js
function getDifficulty(track) {
return track;
}
```
# --solutions--
```js
function getDifficulty(track) {
let score = 0;
for (let i = 0; i < track.length; i++) {
const current = track[i];
const previous = i > 0 ? track[i - 1] : null;
if (current === 'S') {
score += 0;
} else if (current === 'L' || current === 'R') {
if (previous && previous !== 'S' && previous !== current) {
score += 15;
} else if (previous !== 'S') {
score += 5;
} else {
score += 5;
}
}
}
if (score <= 100) return 'Easy';
if (score <= 200) return 'Medium';
return 'Hard';
}
```

View File

@@ -0,0 +1,97 @@
---
id: 697a49e6ff50d756c9b69366
title: "Challenge 189: 2026 Winter Games Day 10: Alpine Skiing"
challengeType: 28
dashedName: challenge-189
---
# --description--
Given a ski hill's vertical drop, horizontal distance, and type, determine the difficulty rating of the hill.
To determine the rating:
- Calculate the steepness of the hill by taking the drop divided by the distance.
- Then, calculate the adjusted steepness based on the hill type:
- `"Downhill"` multiply steepness by 1.2
- `"Slalom"`: multiply steepness by 0.9
- `"Giant Slalom"`: multiply steepness by 1.0
Return:
- `"Green"` if the adjusted steepness is less than or equal to 0.1
- `"Blue"` if the adjusted steepness is greater than 0.1 and less than or equal to 0.25
- `"Black"` if the adjusted steepness is greater than 0.25
# --hints--
`getHillRating(95, 900, "Slalom")` should return `"Green"`.
```js
assert.equal(getHillRating(95, 900, "Slalom"), "Green");
```
`getHillRating(620, 2800, "Downhill")` should return `"Black"`.
```js
assert.equal(getHillRating(620, 2800, "Downhill"), "Black");
```
`getHillRating(420, 1680, "Giant Slalom")` should return `"Blue"`.
```js
assert.equal(getHillRating(420, 1680, "Giant Slalom"), "Blue");
```
`getHillRating(250, 3000, "Downhill")` should return `"Green"`.
```js
assert.equal(getHillRating(250, 3000, "Downhill"), "Green");
```
`getHillRating(110, 900, "Slalom")` should return `"Blue"`.
```js
assert.equal(getHillRating(110, 900, "Slalom"), "Blue");
```
`getHillRating(380, 1500, "Giant Slalom")` should return `"Black"`.
```js
assert.equal(getHillRating(380, 1500, "Giant Slalom"), "Black");
```
# --seed--
## --seed-contents--
```js
function getHillRating(drop, distance, type) {
return drop;
}
```
# --solutions--
```js
function getHillRating(drop, distance, type) {
let steepness = drop / distance;
if (type === "Downhill") {
steepness *= 1.2;
} else if (type === "Slalom") {
steepness *= 0.9;
} else if (type === "Giant Slalom") {
steepness *= 1.0;
}
if (steepness <= 0.1) {
return "Green";
} else if (steepness <= 0.25) {
return "Blue";
} else {
return "Black";
}
}
```

View File

@@ -0,0 +1,75 @@
---
id: 697a49e9860d24853adef67b
title: "Challenge 190: 2026 Winter Games Day 11: Ice Hockey"
challengeType: 28
dashedName: challenge-190
---
# --description--
Given an array of 6 ice hockey teams and their records after the round robin games, determine the match-ups for the semi-final round.
- Each array item will have a team and their record in the format `"TEAM: W-OTW-OTL-L"`. Where:
- `"W"` is the number of wins in regulation, worth 3 points each
- `"OTW"` is the number of overtime wins, worth 2 points each
- `"OTL"` is the number of overtime losses, worth 1 point each
- `"L"` is the number of losses, worth 0 points each
For example, `"FIN: 2-2-1-0"` would have 11 points after adding up their record.
Find the total number of points for each team and return `"The semi-final games will be (1st) vs (4th) and (2nd) vs (3rd)."`. For example, `"The semi-final games will be FIN vs SWE and CAN vs USA."`
# --hints--
`getSemifinalMatchups(["CAN: 2-2-0-1", "FIN: 2-2-1-0", "GER: 1-0-1-3", "SUI: 0-1-3-1", "SWE: 1-1-2-1", "USA: 2-1-0-2"])` should return `"The semi-final games will be FIN vs SWE and CAN vs USA."`.
```js
assert.equal(getSemifinalMatchups(["CAN: 2-2-0-1", "FIN: 2-2-1-0", "GER: 1-0-1-3", "SUI: 0-1-3-1", "SWE: 1-1-2-1", "USA: 2-1-0-2"]), "The semi-final games will be FIN vs SWE and CAN vs USA.");
```
`getSemifinalMatchups(["CAN: 2-1-1-1", "CZE: 1-1-1-2", "FIN: 1-2-1-1", "NOR: 0-1-1-3", "SLO: 1-0-1-3", "USA: 5-0-0-0"])` should return `"The semi-final games will be USA vs CZE and CAN vs FIN."`.
```js
assert.equal(getSemifinalMatchups(["CAN: 2-1-1-1", "CZE: 1-1-1-2", "FIN: 1-2-1-1", "NOR: 0-1-1-3", "SLO: 1-0-1-3", "USA: 5-0-0-0"]), "The semi-final games will be USA vs CZE and CAN vs FIN.");
```
`getSemifinalMatchups(["CAN: 3-2-0-0", "CZE: 2-1-2-0", "LAT: 0-0-1-4", "ITA: 1-1-1-2", "DEN: 1-0-0-4", "USA: 3-1-1-0"])` should return `"The semi-final games will be CAN vs ITA and USA vs CZE."`.
```js
assert.equal(getSemifinalMatchups(["CAN: 3-2-0-0", "CZE: 2-1-2-0", "LAT: 0-0-1-4", "ITA: 1-1-1-2", "DEN: 1-0-0-4", "USA: 3-1-1-0"]), "The semi-final games will be CAN vs ITA and USA vs CZE.");
```
`getSemifinalMatchups(["AUT: 2-2-1-0", "DEN: 1-0-0-4", "ITA: 1-1-1-2", "JPN: 3-2-0-0", "KOR: 2-1-2-0", "LAT: 0-0-1-4"])` should return `"The semi-final games will be JPN vs ITA and AUT vs KOR."`.
```js
assert.equal(getSemifinalMatchups(["AUT: 2-2-1-0", "DEN: 1-0-0-4", "ITA: 1-1-1-2", "JPN: 3-2-0-0", "KOR: 2-1-2-0", "LAT: 0-0-1-4"]), "The semi-final games will be JPN vs ITA and AUT vs KOR.");
```
# --seed--
## --seed-contents--
```js
function getSemifinalMatchups(teams) {
return teams;
}
```
# --solutions--
```js
function getSemifinalMatchups(teams) {
const teamPoints = teams.map(teamStr => {
const [name, record] = teamStr.split(": ");
const [W, OTW, OTL, L] = record.split("-").map(Number);
const points = W * 3 + OTW * 2 + OTL * 1 + L * 0;
return { name, points };
});
teamPoints.sort((a, b) => b.points - a.points);
const [first, second, third, fourth] = teamPoints;
return `The semi-final games will be ${first.name} vs ${fourth.name} and ${second.name} vs ${third.name}.`;
}
```

View File

@@ -0,0 +1,122 @@
---
id: 697a49e9860d24853adef67c
title: "Challenge 191: 2026 Winter Games Day 12: Bobsled"
challengeType: 28
dashedName: challenge-191
---
# --description--
Given an array representing the weights of the athletes on a bobsled team and a number representing the weight of the bobsled, determine whether the team is eligible to race.
- The length of the array determines the team size: 1, 2 or 4 person teams.
- All given weight values are in kilograms (kg).
The bobsled (sled by iteself) must have a minimum weight of:
- 162 kg for a 1-person team
- 170 kg for a 2-person team
- 210 kg for a 4-person team
The total weight of the bobsled (athletes plus sled) must not exceed:
- 247 kg for a 1-person team
- 390 kg for a 2-person team
- 630 kg for a 4-person team
Return "Eligible" if the team meets all the requirements, or `"Not Eligible"` if the team fails to meet one or more of the requirements.
# --hints--
`checkEligibility([78], 165)` should return `"Eligible"`.
```js
assert.equal(checkEligibility([78], 165), "Eligible");
```
`checkEligibility([80], 160)` should return `"Not Eligible"`.
```js
assert.equal(checkEligibility([80], 160), "Not Eligible");
```
`checkEligibility([80], 170)` should return `"Not Eligible"`.
```js
assert.equal(checkEligibility([80], 170), "Not Eligible");
```
`checkEligibility([85, 90], 170)` should return `"Eligible"`.
```js
assert.equal(checkEligibility([85, 90], 170), "Eligible");
```
`checkEligibility([85, 95], 168)` should return `"Not Eligible"`.
```js
assert.equal(checkEligibility([85, 95], 168), "Not Eligible");
```
`checkEligibility([112, 97], 185)` should return `"Not Eligible"`.
```js
assert.equal(checkEligibility([112, 97], 185), "Not Eligible");
```
`checkEligibility([110, 102, 90, 106], 222)` should return `"Eligible"`.
```js
assert.equal(checkEligibility([110, 102, 90, 106], 222), "Eligible");
```
`checkEligibility([106, 99, 90, 88], 205)` should return `"Not Eligible"`.
```js
assert.equal(checkEligibility([106, 99, 90, 88], 205), "Not Eligible");
```
`checkEligibility([106, 99, 103, 96], 227)` should return `"Not Eligible"`.
```js
assert.equal(checkEligibility([106, 99, 103, 96], 227), "Not Eligible");
```
# --seed--
## --seed-contents--
```js
function checkEligibility(athleteWeights, sledWeight) {
return athleteWeights;
}
```
# --solutions--
```js
function checkEligibility(athleteWeights, sledWeight) {
const teamSize = athleteWeights.length;
const rules = {
1: { minSled: 162, maxTotal: 247 },
2: { minSled: 170, maxTotal: 390 },
4: { minSled: 210, maxTotal: 630 }
};
const { minSled, maxTotal } = rules[teamSize];
const athleteTotal = athleteWeights.reduce((sum, w) => sum + w, 0);
const totalWeight = athleteTotal + sledWeight;
if (sledWeight < minSled) {
return "Not Eligible";
}
if (totalWeight > maxTotal) {
return "Not Eligible";
}
return "Eligible";
}
```

View File

@@ -0,0 +1,60 @@
---
id: 697a49e9860d24853adef67d
title: "Challenge 192: 2026 Winter Games Day 13: Nordic Combined"
challengeType: 28
dashedName: challenge-192
---
# --description--
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.
# --hints--
`calculateStartDelays([120, 110, 125])` should return `[8, 23, 0]`.
```js
assert.deepEqual(calculateStartDelays([120, 110, 125]), [8, 23, 0]);
```
`calculateStartDelays([118, 125, 122, 120])` should return `[11, 0, 5, 8]`.
```js
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]`.
```js
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]`.
```js
assert.deepEqual(calculateStartDelays([130, 125, 128, 120, 118, 122, 127, 115, 132, 124]), [3, 11, 6, 18, 21, 15, 8, 26, 0, 12]);
```
# --seed--
## --seed-contents--
```js
function calculateStartDelays(jumpScores) {
return jumpScores
}
```
# --solutions--
```js
function calculateStartDelays(jumpScores) {
const bestJump = Math.max(...jumpScores);
return jumpScores.map(score => Math.ceil((bestJump - score) * 1.5));
}
```

View File

@@ -0,0 +1,114 @@
---
id: 697a49e9860d24853adef67e
title: "Challenge 193: 2026 Winter Games Day 14: Ski Mountaineering"
challengeType: 28
dashedName: challenge-193
---
# --description--
Given the snow depth and slope of a mountain, determine if there's an avalanche risk.
- The snow depth values are `"Shallow"`, `"Moderate"`, or `"Deep"`.
- Slope values are `"Gentle"`, `"Steep"`, or `"Very Steep"`.
Return `"Safe"` or `"Risky"` based on this table:
| |`"Shallow"`|`"Moderate"`|`"Deep"`|
|-|-|-|-|
|`"Gentle"`|`"Safe"`|`"Safe"`|`"Safe"`|
|`"Steep"`|`"Safe"`|`"Risky"`|`"Risky"`|
|`"Very Steep"`|`"Safe"`| `"Risky"`|`"Risky"`|
# --hints--
`avalancheRisk("Shallow", "Gentle")` should return `"Safe"`.
```js
assert.equal(avalancheRisk("Shallow", "Gentle"), "Safe");
```
`avalancheRisk("Shallow", "Steep")` should return `"Safe"`.
```js
assert.equal(avalancheRisk("Shallow", "Steep"), "Safe");
```
`avalancheRisk("Shallow", "Very Steep")` should return `"Safe"`.
```js
assert.equal(avalancheRisk("Shallow", "Very Steep"), "Safe");
```
`avalancheRisk("Moderate", "Gentle")` should return `"Safe"`.
```js
assert.equal(avalancheRisk("Moderate", "Gentle"), "Safe");
```
`avalancheRisk("Moderate", "Steep")` should return `"Risky"`.
```js
assert.equal(avalancheRisk("Moderate", "Steep"), "Risky");
```
`avalancheRisk("Moderate", "Very Steep")` should return `"Risky"`.
```js
assert.equal(avalancheRisk("Moderate", "Very Steep"), "Risky");
```
`avalancheRisk("Deep", "Gentle")` should return `"Safe"`.
```js
assert.equal(avalancheRisk("Deep", "Gentle"), "Safe");
```
`avalancheRisk("Deep", "Steep")` should return `"Risky"`.
```js
assert.equal(avalancheRisk("Deep", "Steep"), "Risky");
```
`avalancheRisk("Deep", "Very Steep")` should return `"Risky"`.
```js
assert.equal(avalancheRisk("Deep", "Very Steep"), "Risky");
```
# --seed--
## --seed-contents--
```js
function avalancheRisk(snowDepth, slope) {
return snowDepth;
}
```
# --solutions--
```js
function avalancheRisk(snowDepth, slope) {
const riskTable = {
Gentle: {
Shallow: "Safe",
Moderate: "Safe",
Deep: "Safe",
},
Steep: {
Shallow: "Safe",
Moderate: "Risky",
Deep: "Risky",
},
"Very Steep": {
Shallow: "Safe",
Moderate: "Risky",
Deep: "Risky",
},
};
return riskTable[slope][snowDepth];
}
```

View File

@@ -0,0 +1,106 @@
---
id: 697a49e9860d24853adef67f
title: "Challenge 194: 2026 Winter Games Day 15: Freestyle Skiing"
challengeType: 28
dashedName: challenge-194
---
# --description--
Given a trick name consisting of two words, determine if it is a valid freestyle skiing trick name.
A trick is valid if the first word is in the list of valid first words, and the second word is in the list of valid second words.
- The two words will be separated by a single space.
Valid first words:
|`"Misty"`|
|-|
|`"Ghost"`|
|`"Thunder"`|
|`"Solar"`|
|`"Sky"`|
|`"Phantom"`|
|`"Frozen"`|
|`"Polar"`|
Valid second words:
|`"Twister"`|
|-|
|`"Icequake"`|
|`"Avalanche"`|
|`"Vortex"`|
|`"Snowstorm"`|
|`"Frostbite"`|
|`"Blizzard"`|
|`"Shadow"`|
# --hints--
`isValidTrick("Polar Vortex")` should return `true`.
```js
assert.isTrue(isValidTrick("Polar Vortex"));
```
`isValidTrick("Solar Icequake")` should return `true`.
```js
assert.isTrue(isValidTrick("Solar Icequake"));
```
`isValidTrick("Thunder Blizzard")` should return `true`.
```js
assert.isTrue(isValidTrick("Thunder Blizzard"));
```
`isValidTrick("Phantom Frostbite")` should return `true`.
```js
assert.isTrue(isValidTrick("Phantom Frostbite"));
```
`isValidTrick("Ghost Avalanche")` should return `true`.
```js
assert.isTrue(isValidTrick("Ghost Avalanche"));
```
`isValidTrick("Snowstorm Shadow")` should return `false`.
```js
assert.isFalse(isValidTrick("Snowstorm Shadow"));
```
`isValidTrick("Solar Sky")` should return `false`.
```js
assert.isFalse(isValidTrick("Solar Sky"));
```
# --seed--
## --seed-contents--
```js
function isValidTrick(trickName) {
return trickName;
}
```
# --solutions--
```js
function isValidTrick(trickName) {
const validFirst = ["Misty", "Ghost", "Thunder", "Solar", "Sky", "Phantom", "Frozen", "Polar"];
const validSecond = ["Twister", "Icequake", "Avalanche", "Vortex", "Snowstorm", "Frostbite", "Blizzard", "Shadow"];
const words = trickName.split(" ");
const [first, second] = words;
return validFirst.includes(first) && validSecond.includes(second);
}
```

View File

@@ -0,0 +1,142 @@
---
id: 697a49e9860d24853adef680
title: "Challenge 195: 2026 Winter Games Day 16: Curling"
challengeType: 28
dashedName: challenge-195
---
# --description--
Given a 5x5 matrix representing the "house" at the end of a curling round, determine which team scores and how many points they score.
The layout:
- The center cell (index `[2, 2]`) is the "button".
- The 8 cells directly surrounding the button represent ring 1.
- And the 16 cells on the outer edge of the house represent ring 2.
In the given matrix:
- `"."` represents an empty space.
- `"R"` represents a space with a red stone.
- `"Y"` represents a space with a yellow stone.
Scoring rules:
- Only one team can score per round.
- The team with the stone closest to the button scores.
- The scoring team earns 1 point for each of their stones that is closer to the button than the opponent's closest stone.
- The lower the ring number, the closer to the center the stone is.
- If both teams' closest stone is the same distance from the center, no team scores.
Return:
- A string in the format `"team: number_of_points"`. e.g: `"R: 2"`.
- or `"No points awarded"` if neither team scored any points.
For example, given:
```js
[
[".", ".", "R", ".", "."],
[".", "R", ".", ".", "."],
["Y", ".", ".", ".", "."],
[".", "R", ".", ".", "."],
[".", ".", ".", ".", "."]
]
```
Return `"R: 2"`. The two red stones in ring 1 are tied for the closest and are the only two stones closer than yellows closest.
# --hints--
`scoreCurling([[".", ".", "R", ".", "."], [".", "R", ".", ".", "."], ["Y", ".", ".", ".", "."], [".", "R", ".", ".", "."], [".", ".", ".", ".", "."]])` should return `"R: 2"`.
```js
assert.equal(scoreCurling([[".", ".", "R", ".", "."], [".", "R", ".", ".", "."], ["Y", ".", ".", ".", "."], [".", "R", ".", ".", "."], [".", ".", ".", ".", "."]]), "R: 2");
```
`scoreCurling([[".", ".", "R", ".", "."], [".", ".", ".", ".", "."], [".", ".", "Y", ".", "R"], [".", ".", "Y", "Y", "."], [".", "Y", "R", "R", "."]])` should return `"Y: 3"`.
```js
assert.equal(scoreCurling([[".", ".", "R", ".", "."], [".", ".", ".", ".", "."], [".", ".", "Y", ".", "R"], [".", ".", "Y", "Y", "."], [".", "Y", "R", "R", "."]]), "Y: 3");
```
`scoreCurling([[".", "R", "Y", ".", "."], ["Y", ".", ".", ".", "."], [".", ".", ".", ".", "."], [".", "Y", "R", "Y", "."], [".", ".", "R", "R", "."]])` should return `"No points awarded"`.
```js
assert.equal(scoreCurling([[".", "R", "Y", ".", "."], ["Y", ".", ".", ".", "."], [".", ".", ".", ".", "."], [".", "Y", "R", "Y", "."], [".", ".", "R", "R", "."]]), "No points awarded");
```
`scoreCurling([[".", "Y", "Y", ".", "."], ["Y", ".", ".", "R", "."], [".", ".", "R", ".", "."], [".", ".", "R", "R", "."], [".", "Y", "R", "Y", "."]])` should return `"R: 4"`.
```js
assert.equal(scoreCurling([[".", "Y", "Y", ".", "."], ["Y", ".", ".", "R", "."], [".", ".", "R", ".", "."], [".", ".", "R", "R", "."], [".", "Y", "R", "Y", "."]]), "R: 4");
```
`scoreCurling([["Y", "Y", "Y", "Y", "Y"], ["Y", "R", "R", "R", "Y"], ["Y", "R", "Y", "R", "Y"], ["Y", "R", "R", "R", "Y"], ["Y", "Y", "Y", "Y", "Y"]])` should return `"Y: 1"`.
```js
assert.equal(scoreCurling([["Y", "Y", "Y", "Y", "Y"], ["Y", "R", "R", "R", "Y"], ["Y", "R", "Y", "R", "Y"], ["Y", "R", "R", "R", "Y"], ["Y", "Y", "Y", "Y", "Y"]]), "Y: 1");
```
`scoreCurling([["Y", "R", "Y", "R", "Y"], ["R", ".", ".", ".", "R"], ["Y", ".", ".", ".", "Y"], ["R", ".", ".", ".", "R"], ["Y", ".", ".", "R", "Y"]])` should return `"No points awarded"`.
```js
assert.equal(scoreCurling([["Y", "R", "Y", "R", "Y"], ["R", ".", ".", ".", "R"], ["Y", ".", ".", ".", "Y"], ["R", ".", ".", ".", "R"], ["Y", ".", ".", "R", "Y"]]), "No points awarded");
```
# --seed--
## --seed-contents--
```js
function scoreCurling(house) {
return house;
}
```
# --solutions--
```js
function scoreCurling(house) {
const stones = { R: [], Y: [] };
for (let i = 0; i < 5; i++) {
for (let j = 0; j < 5; j++) {
const cell = house[i][j];
if (cell === 'R' || cell === 'Y') {
const distance = Math.max(Math.abs(i - 2), Math.abs(j - 2));
stones[cell].push(distance);
}
}
}
const redClosest = stones.R.length > 0 ? Math.min(...stones.R) : Infinity;
const yellowClosest = stones.Y.length > 0 ? Math.min(...stones.Y) : Infinity;
if (redClosest === Infinity && yellowClosest === Infinity) {
return "No points awarded";
}
if (redClosest === yellowClosest) {
return "No points awarded";
}
let winner, opponentClosest, winningStones;
if (redClosest < yellowClosest) {
winner = 'R';
opponentClosest = yellowClosest;
winningStones = stones.R;
} else {
winner = 'Y';
opponentClosest = redClosest;
winningStones = stones.Y;
}
const points = winningStones.filter(d => d < opponentClosest).length;
return points === 0 ? "No points awarded" : `${winner}: ${points}`;
}
```

View File

@@ -0,0 +1,133 @@
---
id: 697a49e9860d24853adef681
title: "Challenge 196: 2026 Winter Games Day 17: Closing Day"
challengeType: 28
dashedName: challenge-196
---
# --description--
Given a 2D array of medal winners, return a medal count for each country as a CSV string.
- In the given array, each sub-array represents a single event: `[gold_winner, silver_winner, bronze_winner]`
- The returned CSV string should have the following format, with the first line being headers:
```sh
Country,Gold,Silver,Bronze,Total
country_name,gold_count,silver_count,bronze_count,total_medals
```
- Separate new lines with the new line character (`"\n"`).
- Do not include spaces around commas or at the end of lines.
- Sort the returned CSV by gold medal count, highest first. If two countries have the same gold medal count, sort the tied ones alphabetically.
For example, given:
```js
[
["USA", "CAN", "NOR"],
["NOR", "USA", "CAN"],
["USA", "NOR", "SWE"]
]
```
Return:
```sh
"Country,Gold,Silver,Bronze,Total\nUSA,2,1,0,3\nNOR,1,1,1,3\nCAN,0,1,1,2\nSWE,0,0,1,1"
```
Which looks like this when printed:
```sh
Country,Gold,Silver,Bronze,Total
USA,2,1,0,3
NOR,1,1,1,3
CAN,0,1,1,2
SWE,0,0,1,1
```
# --hints--
`countMedals([["USA", "CAN", "NOR"], ["NOR", "USA", "CAN"], ["USA", "NOR", "SWE"]])` should return `"Country,Gold,Silver,Bronze,Total\nUSA,2,1,0,3\nNOR,1,1,1,3\nCAN,0,1,1,2\nSWE,0,0,1,1"`.
```js
assert.equal(countMedals([["USA", "CAN", "NOR"], ["NOR", "USA", "CAN"], ["USA", "NOR", "SWE"]]), "Country,Gold,Silver,Bronze,Total\nUSA,2,1,0,3\nNOR,1,1,1,3\nCAN,0,1,1,2\nSWE,0,0,1,1");
```
`countMedals([["NOR","SWE","FIN"]])` should return `"Country,Gold,Silver,Bronze,Total\nNOR,1,0,0,1\nFIN,0,0,1,1\nSWE,0,1,0,1"`.
```js
assert.equal(countMedals([["NOR","SWE","FIN"]]), "Country,Gold,Silver,Bronze,Total\nNOR,1,0,0,1\nFIN,0,0,1,1\nSWE,0,1,0,1");
```
`countMedals([["ITA", "CHN", "CHN"], ["JPN", "ITA", "JPN"]])` should return `"Country,Gold,Silver,Bronze,Total\nITA,1,1,0,2\nJPN,1,0,1,2\nCHN,0,1,1,2"`.
```js
assert.equal(countMedals([["ITA", "CHN", "CHN"], ["JPN", "ITA", "JPN"]]), "Country,Gold,Silver,Bronze,Total\nITA,1,1,0,2\nJPN,1,0,1,2\nCHN,0,1,1,2");
```
`countMedals([["USA","CAN","NOR"], ["GER","FRA","ITA"], ["JPN","KOR","CHN"], ["SWE","FIN","NOR"], ["CAN","USA","SWE"], ["FRA","GER","ITA"]])` should return `"Country,Gold,Silver,Bronze,Total\nCAN,1,1,0,2\nFRA,1,1,0,2\nGER,1,1,0,2\nJPN,1,0,0,1\nSWE,1,0,1,2\nUSA,1,1,0,2\nCHN,0,0,1,1\nFIN,0,1,0,1\nITA,0,0,2,2\nKOR,0,1,0,1\nNOR,0,0,2,2"`.
```js
assert.equal(countMedals([["USA","CAN","NOR"], ["GER","FRA","ITA"], ["JPN","KOR","CHN"], ["SWE","FIN","NOR"], ["CAN","USA","SWE"], ["FRA","GER","ITA"]]), "Country,Gold,Silver,Bronze,Total\nCAN,1,1,0,2\nFRA,1,1,0,2\nGER,1,1,0,2\nJPN,1,0,0,1\nSWE,1,0,1,2\nUSA,1,1,0,2\nCHN,0,0,1,1\nFIN,0,1,0,1\nITA,0,0,2,2\nKOR,0,1,0,1\nNOR,0,0,2,2");
```
`countMedals([["ESP","ITA","FRA"], ["ITA","ESP","GER"], ["NOR","SWE","FIN"], ["FIN","NOR","SWE"], ["USA","CAN","MEX"], ["CAN","USA","MEX"], ["JPN","KOR","CHN"], ["CHN","JPN","KOR"]])` should return `"Country,Gold,Silver,Bronze,Total\nCAN,1,1,0,2\nCHN,1,0,1,2\nESP,1,1,0,2\nFIN,1,0,1,2\nITA,1,1,0,2\nJPN,1,1,0,2\nNOR,1,1,0,2\nUSA,1,1,0,2\nFRA,0,0,1,1\nGER,0,0,1,1\nKOR,0,1,1,2\nMEX,0,0,2,2\nSWE,0,1,1,2"`.
```js
assert.equal(countMedals([["ESP","ITA","FRA"], ["ITA","ESP","GER"], ["NOR","SWE","FIN"], ["FIN","NOR","SWE"], ["USA","CAN","MEX"], ["CAN","USA","MEX"], ["JPN","KOR","CHN"], ["CHN","JPN","KOR"]]), "Country,Gold,Silver,Bronze,Total\nCAN,1,1,0,2\nCHN,1,0,1,2\nESP,1,1,0,2\nFIN,1,0,1,2\nITA,1,1,0,2\nJPN,1,1,0,2\nNOR,1,1,0,2\nUSA,1,1,0,2\nFRA,0,0,1,1\nGER,0,0,1,1\nKOR,0,1,1,2\nMEX,0,0,2,2\nSWE,0,1,1,2");
```
`countMedals([["USA","CAN","GER"], ["NOR","SWE","FIN"], ["USA","NOR","SWE"], ["GER","FRA","ITA"], ["JPN","KOR","CHN"], ["USA","GER","CAN"], ["SWE","NOR","FIN"], ["CAN","USA","NOR"], ["FRA","GER","ITA"], ["JPN","CHN","KOR"], ["SWE","FIN","NOR"], ["GER","ITA","FRA"]])` should return `"Country,Gold,Silver,Bronze,Total\nUSA,3,1,0,4\nGER,2,2,1,5\nJPN,2,0,0,2\nSWE,2,1,1,4\nCAN,1,1,1,3\nFRA,1,1,1,3\nNOR,1,2,2,5\nCHN,0,1,1,2\nFIN,0,1,2,3\nITA,0,1,2,3\nKOR,0,1,1,2"`.
```js
assert.equal(countMedals([["USA","CAN","GER"], ["NOR","SWE","FIN"], ["USA","NOR","SWE"], ["GER","FRA","ITA"], ["JPN","KOR","CHN"], ["USA","GER","CAN"], ["SWE","NOR","FIN"], ["CAN","USA","NOR"], ["FRA","GER","ITA"], ["JPN","CHN","KOR"], ["SWE","FIN","NOR"], ["GER","ITA","FRA"]]), "Country,Gold,Silver,Bronze,Total\nUSA,3,1,0,4\nGER,2,2,1,5\nJPN,2,0,0,2\nSWE,2,1,1,4\nCAN,1,1,1,3\nFRA,1,1,1,3\nNOR,1,2,2,5\nCHN,0,1,1,2\nFIN,0,1,2,3\nITA,0,1,2,3\nKOR,0,1,1,2");
```
# --seed--
## --seed-contents--
```js
function countMedals(winners) {
return winners;
}
```
# --solutions--
```js
function countMedals(winners) {
const counts = {};
for (const [gold, silver, bronze] of winners) {
if (!counts[gold]) counts[gold] = { Gold: 0, Silver: 0, Bronze: 0 };
if (!counts[silver]) counts[silver] = { Gold: 0, Silver: 0, Bronze: 0 };
if (!counts[bronze]) counts[bronze] = { Gold: 0, Silver: 0, Bronze: 0 };
counts[gold].Gold += 1;
counts[silver].Silver += 1;
counts[bronze].Bronze += 1;
}
const countries = Object.entries(counts).map(([country, medals]) => ({
Country: country,
Gold: medals.Gold,
Silver: medals.Silver,
Bronze: medals.Bronze,
Total: medals.Gold + medals.Silver + medals.Bronze
}));
countries.sort((a, b) => b.Gold - a.Gold || a.Country.localeCompare(b.Country));
const lines = ["Country,Gold,Silver,Bronze,Total"];
for (const c of countries) {
lines.push(`${c.Country},${c.Gold},${c.Silver},${c.Bronze},${c.Total}`);
}
return lines.join("\n");
}
```

View File

@@ -0,0 +1,948 @@
---
id: 697a49e6ff50d756c9b6935d
title: "Challenge 180: 2026 Winter Games Day 1: Opening Day"
challengeType: 29
dashedName: challenge-180
---
# --description--
Today marks the start of the 2026 Winter Games. The next 17 days will bring you coding challenges inspired by them.
For the first one, you are given a two-letter country code and need to return the flag emoji for that country.
Use this list:
| Country | Code | Flag |
| - | -: | :--: |
| Albania | `"AL"` | `"🇦🇱"` |
| Andorra | `"AD"` | `"🇦🇩"` |
| Argentina | `"AR"` | `"🇦🇷"` |
| Armenia | `"AM"` | `"🇦🇲"` |
| Australia | `"AU"` | `"🇦🇺"` |
| Austria | `"AT"` | `"🇦🇹"` |
| Azerbaijan | `"AZ"` | `"🇦🇿"` |
| Belgium | `"BE"` | `"🇧🇪"` |
| Benin | `"BJ"` | `"🇧🇯"` |
| Bolivia | `"BO"` | `"🇧🇴"` |
| Bosnia and Herzegovina | `"BA"` | `"🇧🇦"` |
| Brazil | `"BR"` | `"🇧🇷"` |
| Bulgaria | `"BG"` | `"🇧🇬"` |
| Canada | `"CA"` | `"🇨🇦"` |
| Chile | `"CL"` | `"🇨🇱"` |
| China | `"CN"` | `"🇨🇳"` |
| Colombia | `"CO"` | `"🇨🇴"` |
| Croatia | `"HR"` | `"🇭🇷"` |
| Cyprus | `"CY"` | `"🇨🇾"` |
| Czech Republic | `"CZ"` | `"🇨🇿"` |
| Denmark | `"DK"` | `"🇩🇰"` |
| Ecuador | `"EC"` | `"🇪🇨"` |
| Eritrea | `"ER"` | `"🇪🇷"` |
| Estonia | `"EE"` | `"🇪🇪"` |
| Finland | `"FI"` | `"🇫🇮"` |
| France | `"FR"` | `"🇫🇷"` |
| Georgia | `"GE"` | `"🇬🇪"` |
| Germany | `"DE"` | `"🇩🇪"` |
| Great Britain | `"GB"` | `"🇬🇧"` |
| Greece | `"GR"` | `"🇬🇷"` |
| Guinea-Bissau | `"GW"` | `"🇬🇼"` |
| Haiti | `"HT"` | `"🇭🇹"` |
| Hong Kong | `"HK"` | `"🇭🇰"` |
| Hungary | `"HU"` | `"🇭🇺"` |
| Iceland | `"IS"` | `"🇮🇸"` |
| India | `"IN"` | `"🇮🇳"` |
| Iran | `"IR"` | `"🇮🇷"` |
| Ireland | `"IE"` | `"🇮🇪"` |
| Israel | `"IL"` | `"🇮🇱"` |
| Italy | `"IT"` | `"🇮🇹"` |
| Jamaica | `"JM"` | `"🇯🇲"` |
| Japan | `"JP"` | `"🇯🇵"` |
| Kazakhstan | `"KZ"` | `"🇰🇿"` |
| Kenya | `"KE"` | `"🇰🇪"` |
| Kosovo | `"XK"` | `"🇽🇰"` |
| Kyrgyzstan | `"KG"` | `"🇰🇬"` |
| Latvia | `"LV"` | `"🇱🇻"` |
| Lebanon | `"LB"` | `"🇱🇧"` |
| Liechtenstein | `"LI"` | `"🇱🇮"` |
| Lithuania | `"LT"` | `"🇱🇹"` |
| Luxembourg | `"LU"` | `"🇱🇺"` |
| Madagascar | `"MG"` | `"🇲🇬"` |
| Malaysia | `"MY"` | `"🇲🇾"` |
| Malta | `"MT"` | `"🇲🇹"` |
| Mexico | `"MX"` | `"🇲🇽"` |
| Moldova | `"MD"` | `"🇲🇩"` |
| Monaco | `"MC"` | `"🇲🇨"` |
| Mongolia | `"MN"` | `"🇲🇳"` |
| Montenegro | `"ME"` | `"🇲🇪"` |
| Morocco | `"MA"` | `"🇲🇦"` |
| Netherlands | `"NL"` | `"🇳🇱"` |
| New Zealand | `"NZ"` | `"🇳🇿"` |
| Nigeria | `"NG"` | `"🇳🇬"` |
| North Macedonia | `"MK"` | `"🇲🇰"` |
| Norway | `"NO"` | `"🇳🇴"` |
| Pakistan | `"PK"` | `"🇵🇰"` |
| Philippines | `"PH"` | `"🇵🇭"` |
| Poland | `"PL"` | `"🇵🇱"` |
| Portugal | `"PT"` | `"🇵🇹"` |
| Puerto Rico | `"PR"` | `"🇵🇷"` |
| Romania | `"RO"` | `"🇷🇴"` |
| San Marino | `"SM"` | `"🇸🇲"` |
| Saudi Arabia | `"SA"` | `"🇸🇦"` |
| Serbia | `"RS"` | `"🇷🇸"` |
| Singapore | `"SG"` | `"🇸🇬"` |
| Slovakia | `"SK"` | `"🇸🇰"` |
| Slovenia | `"SI"` | `"🇸🇮"` |
| South Africa | `"ZA"` | `"🇿🇦"` |
| South Korea | `"KR"` | `"🇰🇷"` |
| Spain | `"ES"` | `"🇪🇸"` |
| Sweden | `"SE"` | `"🇸🇪"` |
| Switzerland | `"CH"` | `"🇨🇭"` |
| Thailand | `"TH"` | `"🇹🇭"` |
| Trinidad & Tobago | `"TT"` | `"🇹🇹"` |
| Turkey | `"TR"` | `"🇹🇷"` |
| Ukraine | `"UA"` | `"🇺🇦"` |
| United Arab Emirates | `"AE"` | `"🇦🇪"` |
| United States | `"US"` | `"🇺🇸"` |
| Uruguay | `"UY"` | `"🇺🇾"` |
| Uzbekistan | `"UZ"` | `"🇺🇿"` |
| Venezuela | `"VE"` | `"🇻🇪"` |
# --hints--
`get_flag("AL")` should return `"🇦🇱"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("AL"), "🇦🇱")`)
}})
```
`get_flag("AD")` should return `"🇦🇩"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("AD"), "🇦🇩")`)
}})
```
`get_flag("AR")` should return `"🇦🇷"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("AR"), "🇦🇷")`)
}})
```
`get_flag("AM")` should return `"🇦🇲"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("AM"), "🇦🇲")`)
}})
```
`get_flag("AU")` should return `"🇦🇺"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("AU"), "🇦🇺")`)
}})
```
`get_flag("AT")` should return `"🇦🇹"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("AT"), "🇦🇹")`)
}})
```
`get_flag("AZ")` should return `"🇦🇿"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("AZ"), "🇦🇿")`)
}})
```
`get_flag("BE")` should return `"🇧🇪"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("BE"), "🇧🇪")`)
}})
```
`get_flag("BJ")` should return `"🇧🇯"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("BJ"), "🇧🇯")`)
}})
```
`get_flag("BO")` should return `"🇧🇴"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("BO"), "🇧🇴")`)
}})
```
`get_flag("BA")` should return `"🇧🇦"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("BA"), "🇧🇦")`)
}})
```
`get_flag("BR")` should return `"🇧🇷"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("BR"), "🇧🇷")`)
}})
```
`get_flag("BG")` should return `"🇧🇬"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("BG"), "🇧🇬")`)
}})
```
`get_flag("CA")` should return `"🇨🇦"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("CA"), "🇨🇦")`)
}})
```
`get_flag("CL")` should return `"🇨🇱"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("CL"), "🇨🇱")`)
}})
```
`get_flag("CN")` should return `"🇨🇳"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("CN"), "🇨🇳")`)
}})
```
`get_flag("CO")` should return `"🇨🇴"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("CO"), "🇨🇴")`)
}})
```
`get_flag("HR")` should return `"🇭🇷"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("HR"), "🇭🇷")`)
}})
```
`get_flag("CY")` should return `"🇨🇾"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("CY"), "🇨🇾")`)
}})
```
`get_flag("CZ")` should return `"🇨🇿"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("CZ"), "🇨🇿")`)
}})
```
`get_flag("DK")` should return `"🇩🇰"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("DK"), "🇩🇰")`)
}})
```
`get_flag("EC")` should return `"🇪🇨"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("EC"), "🇪🇨")`)
}})
```
`get_flag("ER")` should return `"🇪🇷"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("ER"), "🇪🇷")`)
}})
```
`get_flag("EE")` should return `"🇪🇪"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("EE"), "🇪🇪")`)
}})
```
`get_flag("FI")` should return `"🇫🇮"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("FI"), "🇫🇮")`)
}})
```
`get_flag("FR")` should return `"🇫🇷"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("FR"), "🇫🇷")`)
}})
```
`get_flag("GE")` should return `"🇬🇪"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("GE"), "🇬🇪")`)
}})
```
`get_flag("DE")` should return `"🇩🇪"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("DE"), "🇩🇪")`)
}})
```
`get_flag("GB")` should return `"🇬🇧"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("GB"), "🇬🇧")`)
}})
```
`get_flag("GR")` should return `"🇬🇷"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("GR"), "🇬🇷")`)
}})
```
`get_flag("GW")` should return `"🇬🇼"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("GW"), "🇬🇼")`)
}})
```
`get_flag("HT")` should return `"🇭🇹"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("HT"), "🇭🇹")`)
}})
```
`get_flag("HK")` should return `"🇭🇰"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("HK"), "🇭🇰")`)
}})
```
`get_flag("HU")` should return `"🇭🇺"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("HU"), "🇭🇺")`)
}})
```
`get_flag("IS")` should return `"🇮🇸"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("IS"), "🇮🇸")`)
}})
```
`get_flag("IN")` should return `"🇮🇳"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("IN"), "🇮🇳")`)
}})
```
`get_flag("IR")` should return `"🇮🇷"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("IR"), "🇮🇷")`)
}})
```
`get_flag("IE")` should return `"🇮🇪"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("IE"), "🇮🇪")`)
}})
```
`get_flag("IL")` should return `"🇮🇱"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("IL"), "🇮🇱")`)
}})
```
`get_flag("IT")` should return `"🇮🇹"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("IT"), "🇮🇹")`)
}})
```
`get_flag("JM")` should return `"🇯🇲"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("JM"), "🇯🇲")`)
}})
```
`get_flag("JP")` should return `"🇯🇵"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("JP"), "🇯🇵")`)
}})
```
`get_flag("KZ")` should return `"🇰🇿"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("KZ"), "🇰🇿")`)
}})
```
`get_flag("KE")` should return `"🇰🇪"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("KE"), "🇰🇪")`)
}})
```
`get_flag("XK")` should return `"🇽🇰"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("XK"), "🇽🇰")`)
}})
```
`get_flag("KG")` should return `"🇰🇬"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("KG"), "🇰🇬")`)
}})
```
`get_flag("LV")` should return `"🇱🇻"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("LV"), "🇱🇻")`)
}})
```
`get_flag("LB")` should return `"🇱🇧"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("LB"), "🇱🇧")`)
}})
```
`get_flag("LI")` should return `"🇱🇮"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("LI"), "🇱🇮")`)
}})
```
`get_flag("LT")` should return `"🇱🇹"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("LT"), "🇱🇹")`)
}})
```
`get_flag("LU")` should return `"🇱🇺"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("LU"), "🇱🇺")`)
}})
```
`get_flag("MG")` should return `"🇲🇬"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("MG"), "🇲🇬")`)
}})
```
`get_flag("MY")` should return `"🇲🇾"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("MY"), "🇲🇾")`)
}})
```
`get_flag("MT")` should return `"🇲🇹"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("MT"), "🇲🇹")`)
}})
```
`get_flag("MX")` should return `"🇲🇽"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("MX"), "🇲🇽")`)
}})
```
`get_flag("MD")` should return `"🇲🇩"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("MD"), "🇲🇩")`)
}})
```
`get_flag("MC")` should return `"🇲🇨"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("MC"), "🇲🇨")`)
}})
```
`get_flag("MN")` should return `"🇲🇳"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("MN"), "🇲🇳")`)
}})
```
`get_flag("ME")` should return `"🇲🇪"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("ME"), "🇲🇪")`)
}})
```
`get_flag("MA")` should return `"🇲🇦"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("MA"), "🇲🇦")`)
}})
```
`get_flag("NL")` should return `"🇳🇱"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("NL"), "🇳🇱")`)
}})
```
`get_flag("NZ")` should return `"🇳🇿"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("NZ"), "🇳🇿")`)
}})
```
`get_flag("NG")` should return `"🇳🇬"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("NG"), "🇳🇬")`)
}})
```
`get_flag("MK")` should return `"🇲🇰"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("MK"), "🇲🇰")`)
}})
```
`get_flag("NO")` should return `"🇳🇴"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("NO"), "🇳🇴")`)
}})
```
`get_flag("PK")` should return `"🇵🇰"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("PK"), "🇵🇰")`)
}})
```
`get_flag("PH")` should return `"🇵🇭"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("PH"), "🇵🇭")`)
}})
```
`get_flag("PL")` should return `"🇵🇱"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("PL"), "🇵🇱")`)
}})
```
`get_flag("PT")` should return `"🇵🇹"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("PT"), "🇵🇹")`)
}})
```
`get_flag("PR")` should return `"🇵🇷"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("PR"), "🇵🇷")`)
}})
```
`get_flag("RO")` should return `"🇷🇴"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("RO"), "🇷🇴")`)
}})
```
`get_flag("SM")` should return `"🇸🇲"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("SM"), "🇸🇲")`)
}})
```
`get_flag("SA")` should return `"🇸🇦"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("SA"), "🇸🇦")`)
}})
```
`get_flag("RS")` should return `"🇷🇸"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("RS"), "🇷🇸")`)
}})
```
`get_flag("SG")` should return `"🇸🇬"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("SG"), "🇸🇬")`)
}})
```
`get_flag("SK")` should return `"🇸🇰"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("SK"), "🇸🇰")`)
}})
```
`get_flag("SI")` should return `"🇸🇮"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("SI"), "🇸🇮")`)
}})
```
`get_flag("ZA")` should return `"🇿🇦"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("ZA"), "🇿🇦")`)
}})
```
`get_flag("KR")` should return `"🇰🇷"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("KR"), "🇰🇷")`)
}})
```
`get_flag("ES")` should return `"🇪🇸"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("ES"), "🇪🇸")`)
}})
```
`get_flag("SE")` should return `"🇸🇪"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("SE"), "🇸🇪")`)
}})
```
`get_flag("CH")` should return `"🇨🇭"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("CH"), "🇨🇭")`)
}})
```
`get_flag("TH")` should return `"🇹🇭"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("TH"), "🇹🇭")`)
}})
```
`get_flag("TT")` should return `"🇹🇹"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("TT"), "🇹🇹")`)
}})
```
`get_flag("TR")` should return `"🇹🇷"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("TR"), "🇹🇷")`)
}})
```
`get_flag("UA")` should return `"🇺🇦"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("UA"), "🇺🇦")`)
}})
```
`get_flag("AE")` should return `"🇦🇪"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("AE"), "🇦🇪")`)
}})
```
`get_flag("US")` should return `"🇺🇸"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("US"), "🇺🇸")`)
}})
```
`get_flag("UY")` should return `"🇺🇾"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("UY"), "🇺🇾")`)
}})
```
`get_flag("UZ")` should return `"🇺🇿"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("UZ"), "🇺🇿")`)
}})
```
`get_flag("VE")` should return `"🇻🇪"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_flag("VE"), "🇻🇪")`)
}})
```
# --seed--
## --seed-contents--
```py
def get_flag(code):
return code
```
# --solutions--
```py
def get_flag(code):
return "".join(chr(127397 + ord(char)) for char in code)
```

View File

@@ -0,0 +1,93 @@
---
id: 697a49e6ff50d756c9b6935e
title: "Challenge 181: 2026 Winter Games Day 2: Snowboarding"
challengeType: 29
dashedName: challenge-181
---
# --description--
Given a snowboarder's starting stance and a rotation in degrees, determine their landing stance.
- A snowboarder's stance is either `"Regular"` or `"Goofy"`.
- Trick rotations are multiples of 90 degrees. Positive indicates clockwise rotation, and negative indicate counter-clockwise rotation.
- The landing stance flips every 180 degrees of rotation.
For example, given `"Regular"` and `90`, return `"Regular"`. Given `"Regular"` and `180` degrees, return `"Goofy"`.
# --hints--
`get_landing_stance("Regular", 90)` should return `"Regular"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_landing_stance("Regular", 90), "Regular")`)
}})
```
`get_landing_stance("Regular", 180)` should return `"Goofy"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_landing_stance("Regular", 180), "Goofy")`)
}})
```
`get_landing_stance("Goofy", -270)` should return `"Regular"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_landing_stance("Goofy", -270), "Regular")`)
}})
```
`get_landing_stance("Regular", 2340)` should return `"Goofy"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_landing_stance("Regular", 2340), "Goofy")`)
}})
```
`get_landing_stance("Goofy", 2160)` should return `"Goofy"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_landing_stance("Goofy", 2160), "Goofy")`)
}})
```
`get_landing_stance("Goofy", -540)` should return `"Regular"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_landing_stance("Goofy", -540), "Regular")`)
}})
```
# --seed--
## --seed-contents--
```py
def get_landing_stance(start_stance, rotation):
return start_stance
```
# --solutions--
```py
def get_landing_stance(start_stance, rotation):
flips = abs(rotation) // 180
if flips % 2 == 0:
return start_stance
else:
return "Goofy" if start_stance == "Regular" else "Regular"
```

View File

@@ -0,0 +1,83 @@
---
id: 697a49e6ff50d756c9b6935f
title: "Challenge 182: 2026 Winter Games Day 3: Biathlon"
challengeType: 29
dashedName: 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--
`calculate_penalty_distance([4, 4])` should return `300`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(calculate_penalty_distance([4, 4]), 300)`)
}})
```
`calculate_penalty_distance([5, 5])` should return `0`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(calculate_penalty_distance([5, 5]), 0)`)
}})
```
`calculate_penalty_distance([4, 5, 3, 5])` should return `450`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(calculate_penalty_distance([4, 5, 3, 5]), 450)`)
}})
```
`calculate_penalty_distance([5, 4, 5, 5])` should return `150`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(calculate_penalty_distance([5, 4, 5, 5]), 150)`)
}})
```
`calculate_penalty_distance([4, 3, 0, 3])` should return `1500`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(calculate_penalty_distance([4, 3, 0, 3]), 1500)`)
}})
```
# --seed--
## --seed-contents--
```py
def calculate_penalty_distance(rounds):
return rounds
```
# --solutions--
```py
def calculate_penalty_distance(rounds):
total_penalty = 0
for hits in rounds:
misses = 5 - hits
total_penalty += misses * 150
return total_penalty
```

View File

@@ -0,0 +1,116 @@
---
id: 697a49e6ff50d756c9b69360
title: "Challenge 183: 2026 Winter Games Day 4: Ski Jumping"
challengeType: 29
dashedName: challenge-183
---
# --description--
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.
- Your score is calculated by summing the above four values.
The current total scores of the other jumpers are:
```sh
165.5
172.0
158.0
180.0
169.5
175.0
162.0
170.0
```
- If your score is the best, return `"Gold"`
- If it's second best, return `"Silver"`
- If it's third best, return `"Bronze"`
- Otherwise, return `"No Medal"`
# --hints--
`ski_jump_medal(125.0, 58.0, 0.0, 6.0)` should return `"Gold"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(ski_jump_medal(125.0, 58.0, 0.0, 6.0), "Gold")`)
}})
```
`ski_jump_medal(119.0, 50.0, 1.0, 4.0)` should return `"Bronze"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(ski_jump_medal(119.0, 50.0, 1.0, 4.0), "Bronze")`)
}})
```
`ski_jump_medal(122.0, 52.0, -1.0, 4.0)` should return `"Silver"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(ski_jump_medal(122.0, 52.0, -1.0, 4.0), "Silver")`)
}})
```
`ski_jump_medal(118.0, 50.5, -1.5, 4.0)` should return `"No Medal"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(ski_jump_medal(118.0, 50.5, -1.5, 4.0), "No Medal")`)
}})
```
`ski_jump_medal(124.0, 50.5, 2.0, 5.0)` should return `"Gold"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(ski_jump_medal(124.0, 50.5, 2.0, 5.0), "Gold")`)
}})
```
`ski_jump_medal(119.0, 49.5, 0.0, 3.0)` should return `"No Medal"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(ski_jump_medal(119.0, 49.5, 0.0, 3.0), "No Medal")`)
}})
```
# --seed--
## --seed-contents--
```py
def ski_jump_medal(distance_points, style_points, wind_comp, k_point_bonus):
return distance_points
```
# --solutions--
```py
def ski_jump_medal(distance_points, style_points, wind_comp, k_point_bonus):
my_score = distance_points + style_points + wind_comp + k_point_bonus
other_scores = [165.5, 172.0, 158.0, 180.0, 169.5, 175.0, 162.0, 170.0]
all_scores = other_scores + [my_score]
all_scores.sort(reverse=True)
rank = all_scores.index(my_score) + 1
if rank == 1:
return "Gold"
elif rank == 2:
return "Silver"
elif rank == 3:
return "Bronze"
else:
return "No Medal"
```

View File

@@ -0,0 +1,101 @@
---
id: 697a49e6ff50d756c9b69361
title: "Challenge 184: 2026 Winter Games Day 5: Cross-Country Skiing"
challengeType: 29
dashedName: challenge-184
---
# --description--
Given an array of finish times for a cross-country ski race, convert them into times behind the winner.
- Given times are strings in `"H:MM:SS"` format.
- Given times will be in order from fastest to slowest.
- The winners time (fastest time) should correspond to `"0"`.
- Each other time should show the time behind the winner, in the format `"+M:SS"`.
For example, given `["1:25:32", "1:26:10", "1:27:05"]`, return `["0", "+0:38", "+1:33"]`.
# --hints--
`get_relative_results(["1:25:32", "1:26:10", "1:27:05"])` should return `["0", "+0:38", "+1:33"]`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_relative_results(["1:25:32", "1:26:10", "1:27:05"]), ["0", "+0:38", "+1:33"])`)
}})
```
`get_relative_results(["1:00:01", "1:00:05", "1:00:10"])` should return `["0", "+0:04", "+0:09"]`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_relative_results(["1:00:01", "1:00:05", "1:00:10"]), ["0", "+0:04", "+0:09"])`)
}})
```
`get_relative_results(["1:10:06", "1:10:23", "1:10:48", "1:12:11"])` should return `["0", "+0:17", "+0:42", "+2:05"]`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_relative_results(["1:10:06", "1:10:23", "1:10:48", "1:12:11"]), ["0", "+0:17", "+0:42", "+2:05"])`)
}})
```
`get_relative_results(["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"]`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_relative_results(["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"])`)
}})
```
`get_relative_results(["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"]`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_relative_results(["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"])`)
}})
```
# --seed--
## --seed-contents--
```py
def get_relative_results(results):
return results
```
# --solutions--
```py
def get_relative_results(results):
def time_to_seconds(time_str):
hours, minutes, seconds = map(int, time_str.split(':'))
return hours * 3600 + minutes * 60 + seconds
def seconds_to_time_format(secs):
mins = secs // 60
secs_remainder = secs % 60
return f"+{mins}:{secs_remainder:02d}"
winner_seconds = time_to_seconds(results[0])
relative_results = []
for i, time in enumerate(results):
if i == 0:
relative_results.append('0')
else:
current_seconds = time_to_seconds(time)
difference = current_seconds - winner_seconds
relative_results.append(seconds_to_time_format(difference))
return relative_results
```

View File

@@ -0,0 +1,82 @@
---
id: 697a49e6ff50d756c9b69362
title: "Challenge 185: 2026 Winter Games Day 6: Figure Skating"
challengeType: 29
dashedName: challenge-185
---
# --description--
Given an array of judge scores and optional penalties, calculate the final score for a figure skating routine.
The first argument is an array of 10 judge scores, each a number from 0 to 10. Remove the highest and lowest judge scores and sum the remaining 8 scores to get the base score.
Any additional arguments passed to the function are penalties. Subtract all penalties from the base score to get the final score.
# --hints--
`compute_score([10, 8, 9, 6, 9, 8, 8, 9, 7, 7], 1)` should return `64`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(compute_score([10, 8, 9, 6, 9, 8, 8, 9, 7, 7], 1), 64)`)
}})
```
`compute_score([10, 10, 10, 10, 10, 10, 10, 10, 10, 10])` should return `80`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(compute_score([10, 10, 10, 10, 10, 10, 10, 10, 10, 10]), 80)`)
}})
```
`compute_score([10, 8, 9, 10, 9, 8, 8, 9, 10, 7], 1, 2, 1)` should return `67`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(compute_score([10, 8, 9, 10, 9, 8, 8, 9, 10, 7], 1, 2, 1), 67)`)
}})
```
`compute_score([8.0, 8.5, 9.0, 8.5, 9.0, 8.0, 9.0, 8.5, 9.0, 8.5], 0.5, 1.0)` should return `67.5`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(compute_score([8.0, 8.5, 9.0, 8.5, 9.0, 8.0, 9.0, 8.5, 9.0, 8.5], 0.5, 1.0), 67.5)`)
}})
```
`compute_score([6.0, 8.5, 7.0, 9.0, 7.5, 8.0, 6.5, 9.5, 7.0, 8.0], 1.5, 0.5, 0.5)` should return `59`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(compute_score([6.0, 8.5, 7.0, 9.0, 7.5, 8.0, 6.5, 9.5, 7.0, 8.0], 1.5, 0.5, 0.5), 59)`)
}})
```
# --seed--
## --seed-contents--
```py
def compute_score(judge_scores, *penalties):
return judge_scores
```
# --solutions--
```py
def compute_score(judge_scores, *penalties):
sorted_scores = sorted(judge_scores)
base_score = sum(sorted_scores[1:9])
total_penalty = sum(penalties)
return base_score - total_penalty
```

View File

@@ -0,0 +1,85 @@
---
id: 697a49e6ff50d756c9b69363
title: "Challenge 186: 2026 Winter Games Day 7: Speed Skating"
challengeType: 29
dashedName: challenge-186
---
# --description--
Given two arrays representing the lap times (in seconds) for two speed skaters, return the lap number where the difference in lap times is the largest.
The first element of each array corresponds to lap 1, the second to lap 2, and so on.
# --hints--
`largest_difference([26.11, 25.80, 25.92, 26.23, 26.07], [25.93, 25.74, 26.53, 26.11, 26.30])` should return `3`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(largest_difference([26.11, 25.80, 25.92, 26.23, 26.07], [25.93, 25.74, 26.53, 26.11, 26.30]), 3)`)
}})
```
`largest_difference([27.04, 25.94, 26.22, 26.07, 26.18], [25.59, 25.80, 26.11, 26.01, 26.23])` should return `1`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(largest_difference([27.04, 25.94, 26.22, 26.07, 26.18], [25.59, 25.80, 26.11, 26.01, 26.23]), 1)`)
}})
```
`largest_difference([25.82, 25.90, 26.05, 26.00, 26.48], [25.85, 25.92, 26.07, 25.98, 25.95])` should return `5`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(largest_difference([25.82, 25.90, 26.05, 26.00, 26.48], [25.85, 25.92, 26.07, 25.98, 25.95]), 5)`)
}})
```
`largest_difference([25.88, 26.10, 25.95, 26.05, 26.00], [25.90, 26.55, 25.92, 26.03, 26.01])` should return `2`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(largest_difference([25.88, 26.10, 25.95, 26.05, 26.00], [25.90, 26.55, 25.92, 26.03, 26.01]), 2)`)
}})
```
`largest_difference([25.92, 26.01, 26.05, 25.88, 26.12], [25.95, 26.00, 26.03, 26.45, 26.10])` should return `4`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(largest_difference([25.92, 26.01, 26.05, 25.88, 26.12], [25.95, 26.00, 26.03, 26.45, 26.10]), 4)`)
}})
```
# --seed--
## --seed-contents--
```py
def largest_difference(skater1, skater2):
return skater1
```
# --solutions--
```py
def largest_difference(skater1, skater2):
max_diff = -1
lap_number = 1
for i in range(len(skater1)):
diff = abs(skater1[i] - skater2[i])
if diff > max_diff:
max_diff = diff
lap_number = i + 1
return lap_number
```

View File

@@ -0,0 +1,98 @@
---
id: 697a49e6ff50d756c9b69364
title: "Challenge 187: 2026 Winter Games Day 8: Luge"
challengeType: 29
dashedName: challenge-187
---
# --description--
Given an array of five numbers, each representing the time (in seconds) it took a luger to complete a segment of a track, determine which segment had the fastest speed and what that speed was.
The track is divided into the following segments:
- Segment 1: 320 meters
- Segment 2: 280 meters
- Segment 3: 350 meters
- Segment 4: 300 meters
- Segment 5: 250 meters
The first value in the given array corresponds to the time for segment 1, the second value to segment 2, and so on.
To calculate the speed (in meters per second) for a segment, divide the distance by the time.
Return `"The luger's fastest speed was X m/s on segment Y."`. Where `X` is the fastest speed, rounded to two decimal places, and `Y` is the segment number where the fastest speed occurred.
# --hints--
`get_fastest_speed([9.523, 8.234, 10.012, 9.001, 7.128])` should return `"The luger's fastest speed was 35.07 m/s on segment 5."`
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_fastest_speed([9.523, 8.234, 10.012, 9.001, 7.128]), "The luger's fastest speed was 35.07 m/s on segment 5.")`)
}})
```
`get_fastest_speed([9.381, 7.417, 9.912, 8.815, 7.284])` should return `"The luger's fastest speed was 37.75 m/s on segment 2."`
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_fastest_speed([9.381, 7.417, 9.912, 8.815, 7.284]), "The luger's fastest speed was 37.75 m/s on segment 2.")`)
}})
```
`get_fastest_speed([8.890, 7.601, 9.093, 8.392, 6.912])` should return `"The luger's fastest speed was 38.49 m/s on segment 3."`
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_fastest_speed([8.890, 7.601, 9.093, 8.392, 6.912]), "The luger's fastest speed was 38.49 m/s on segment 3.")`)
}})
```
`get_fastest_speed([8.490, 7.732, 10.103, 8.489, 6.840])` should return `"The luger's fastest speed was 37.69 m/s on segment 1."`
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_fastest_speed([8.490, 7.732, 10.103, 8.489, 6.840]), "The luger's fastest speed was 37.69 m/s on segment 1.")`)
}})
```
`get_fastest_speed([8.204, 7.230, 9.673, 7.645, 6.508])` should return `"The luger's fastest speed was 39.24 m/s on segment 4."`
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_fastest_speed([8.204, 7.230, 9.673, 7.645, 6.508]), "The luger's fastest speed was 39.24 m/s on segment 4.")`)
}})
```
# --seed--
## --seed-contents--
```py
def get_fastest_speed(times):
return times
```
# --solutions--
```py
def get_fastest_speed(times):
distances = [320, 280, 350, 300, 250]
fastest_speed = 0
fastest_segment = 0
for i, t in enumerate(times):
speed = distances[i] / t
if speed > fastest_speed:
fastest_speed = speed
fastest_segment = i + 1 # 1-indexed
return f"The luger's fastest speed was {fastest_speed:.2f} m/s on segment {fastest_segment}."
```

View File

@@ -0,0 +1,117 @@
---
id: 697a49e6ff50d756c9b69365
title: "Challenge 188: 2026 Winter Games Day 9: Skeleton"
challengeType: 29
dashedName: challenge-188
---
# --description--
Given a string representing the curves on a skeleton track, determine the difficulty of the track.
- The given string will only consist of the letters:
- `"L"` for a left turn
- `"R"` for a right turn
- `"S"` for a straight segment
- Each direction change adds 15 points (an `"L"` followed by an `"R"` or vice versa).
- All other curves add 5 points each (all other `"L"` or `"R"` characters).
- Straight segments add 0 points.
The difficulty of the track is based on the total score. Return:
- `"Easy"` if the total is 0 - 100
- `"Medium"` if the total is 101-200
- `"Hard"` if the total is over 200
# --hints--
`get_difficulty("SLSLLSRRLSRLRL")` should return `"Easy"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_difficulty("SLSLLSRRLSRLRL"), "Easy")`)
}})
```
`get_difficulty("LLRSLRLRSLLRLRSLRRLRSRLLS")` should return `"Hard"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_difficulty("LLRSLRLRSLLRLRSLRRLRSRLLS"), "Hard")`)
}})
```
`get_difficulty("SRRRRLSLLRLRSSRLSRL")` should return `"Medium"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_difficulty("SRRRRLSLLRLRSSRLSRL"), "Medium")`)
}})
```
`get_difficulty("LSRLRLSRLRLSLRSLRLLRLSRLRLRSL")` should return `"Hard"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_difficulty("LSRLRLSRLRLSLRSLRLLRLSRLRLRSL"), "Hard")`)
}})
```
`get_difficulty("SLLSSLRLSLSLRSLSSLRL")` should return `"Medium"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_difficulty("SLLSSLRLSLSLRSLSSLRL"), "Medium")`)
}})
```
`get_difficulty("SRSLSRSLSRRSLSRSRSLSRLSRSR")` should return `"Easy"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_difficulty("SRSLSRSLSRRSLSRSRSLSRLSRSR"), "Easy")`)
}})
```
# --seed--
## --seed-contents--
```py
def get_difficulty(track):
return track
```
# --solutions--
```py
def get_difficulty(track):
score = 0
for i in range(len(track)):
current = track[i]
previous = track[i - 1] if i > 0 else None
if current == 'S':
score += 0
elif current == 'L' or current == 'R':
if previous and previous != 'S' and previous != current:
score += 15
else:
score += 5
if score <= 100:
return 'Easy'
elif score <= 200:
return 'Medium'
else:
return 'Hard'
```

View File

@@ -0,0 +1,112 @@
---
id: 697a49e6ff50d756c9b69366
title: "Challenge 189: 2026 Winter Games Day 10: Alpine Skiing"
challengeType: 29
dashedName: challenge-189
---
# --description--
Given a ski hill's vertical drop, horizontal distance, and type, determine the difficulty rating of the hill.
To determine the rating:
- Calculate the steepness of the hill by taking the drop divided by the distance.
- Then, calculate the adjusted steepness based on the hill type:
- `"Downhill"` multiply steepness by 1.2
- `"Slalom"`: multiply steepness by 0.9
- `"Giant Slalom"`: multiply steepness by 1.0
Return:
- `"Green"` if the adjusted steepness is less than or equal to 0.1
- `"Blue"` if the adjusted steepness is greater than 0.1 and less than or equal to 0.25
- `"Black"` if the adjusted steepness is greater than 0.25
# --hints--
`get_hill_rating(95, 900, "Slalom")` should return `"Green"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_hill_rating(95, 900, "Slalom"), "Green")`)
}})
```
`get_hill_rating(620, 2800, "Downhill")` should return `"Black"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_hill_rating(620, 2800, "Downhill"), "Black")`)
}})
```
`get_hill_rating(420, 1680, "Giant Slalom")` should return `"Blue"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_hill_rating(420, 1680, "Giant Slalom"), "Blue")`)
}})
```
`get_hill_rating(250, 3000, "Downhill")` should return `"Green"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_hill_rating(250, 3000, "Downhill"), "Green")`)
}})
```
`get_hill_rating(110, 900, "Slalom")` should return `"Blue"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_hill_rating(110, 900, "Slalom"), "Blue")`)
}})
```
`get_hill_rating(380, 1500, "Giant Slalom")` should return `"Black"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_hill_rating(380, 1500, "Giant Slalom"), "Black")`)
}})
```
# --seed--
## --seed-contents--
```py
def get_hill_rating(drop, distance, hill_type):
return drop
```
# --solutions--
```py
def get_hill_rating(drop, distance, hill_type):
steepness = drop / distance
if hill_type == "Downhill":
steepness *= 1.2
elif hill_type == "Slalom":
steepness *= 0.9
elif hill_type == "Giant Slalom":
steepness *= 1.0
if steepness <= 0.1:
return "Green"
elif steepness <= 0.25:
return "Blue"
else:
return "Black"
```

View File

@@ -0,0 +1,85 @@
---
id: 697a49e9860d24853adef67b
title: "Challenge 190: 2026 Winter Games Day 11: Ice Hockey"
challengeType: 29
dashedName: challenge-190
---
# --description--
Given an array of 6 ice hockey teams and their records after the round robin games, determine the match-ups for the semi-final round.
- Each array item will have a team and their record in the format `"TEAM: W-OTW-OTL-L"`. Where:
- `"W"` is the number of wins in regulation, worth 3 points each
- `"OTW"` is the number of overtime wins, worth 2 points each
- `"OTL"` is the number of overtime losses, worth 1 point each
- `"L"` is the number of losses, worth 0 points each
For example, `"FIN: 2-2-1-0"` would have 11 points after adding up their record.
Find the total number of points for each team and return `"The semi-final games will be (1st) vs (4th) and (2nd) vs (3rd)."`. For example, `"The semi-final games will be FIN vs SWE and CAN vs USA."`
# --hints--
`get_semifinal_matchups(["CAN: 2-2-0-1", "FIN: 2-2-1-0", "GER: 1-0-1-3", "SUI: 0-1-3-1", "SWE: 1-1-2-1", "USA: 2-1-0-2"])` should return `"The semi-final games will be FIN vs SWE and CAN vs USA."`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_semifinal_matchups(["CAN: 2-2-0-1", "FIN: 2-2-1-0", "GER: 1-0-1-3", "SUI: 0-1-3-1", "SWE: 1-1-2-1", "USA: 2-1-0-2"]), "The semi-final games will be FIN vs SWE and CAN vs USA.")`)
}})
```
`get_semifinal_matchups(["CAN: 2-1-1-1", "CZE: 1-1-1-2", "FIN: 1-2-1-1", "NOR: 0-1-1-3", "SLO: 1-0-1-3", "USA: 5-0-0-0"])` should return `"The semi-final games will be USA vs CZE and CAN vs FIN."`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_semifinal_matchups(["CAN: 2-1-1-1", "CZE: 1-1-1-2", "FIN: 1-2-1-1", "NOR: 0-1-1-3", "SLO: 1-0-1-3", "USA: 5-0-0-0"]), "The semi-final games will be USA vs CZE and CAN vs FIN.")`)
}})
```
`get_semifinal_matchups(["CAN: 3-2-0-0", "CZE: 2-1-2-0", "LAT: 0-0-1-4", "ITA: 1-1-1-2", "DEN: 1-0-0-4", "USA: 3-1-1-0"])` should return `"The semi-final games will be CAN vs ITA and USA vs CZE."`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_semifinal_matchups(["CAN: 3-2-0-0", "CZE: 2-1-2-0", "LAT: 0-0-1-4", "ITA: 1-1-1-2", "DEN: 1-0-0-4", "USA: 3-1-1-0"]), "The semi-final games will be CAN vs ITA and USA vs CZE.")`)
}})
```
`get_semifinal_matchups(["AUT: 2-2-1-0", "DEN: 1-0-0-4", "ITA: 1-1-1-2", "JPN: 3-2-0-0", "KOR: 2-1-2-0", "LAT: 0-0-1-4"])` should return `"The semi-final games will be JPN vs ITA and AUT vs KOR."`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(get_semifinal_matchups(["AUT: 2-2-1-0", "DEN: 1-0-0-4", "ITA: 1-1-1-2", "JPN: 3-2-0-0", "KOR: 2-1-2-0", "LAT: 0-0-1-4"]), "The semi-final games will be JPN vs ITA and AUT vs KOR.")`)
}})
```
# --seed--
## --seed-contents--
```py
def get_semifinal_matchups(teams):
return teams
```
# --solutions--
```py
def get_semifinal_matchups(teams):
team_points = []
for team_str in teams:
name, record = team_str.split(": ")
W, OTW, OTL, L = map(int, record.split("-"))
points = W * 3 + OTW * 2 + OTL * 1 + L * 0
team_points.append((name, points))
team_points.sort(key=lambda x: x[1], reverse=True)
first, second, third, fourth = team_points[:4]
return f"The semi-final games will be {first[0]} vs {fourth[0]} and {second[0]} vs {third[0]}."
```

View File

@@ -0,0 +1,146 @@
---
id: 697a49e9860d24853adef67c
title: "Challenge 191: 2026 Winter Games Day 12: Bobsled"
challengeType: 29
dashedName: challenge-191
---
# --description--
Given an array representing the weights of the athletes on a bobsled team and a number representing the weight of the bobsled, determine whether the team is eligible to race.
- The length of the array determines the team size: 1, 2 or 4 person teams.
- All given weight values are in kilograms (kg).
The bobsled (sled by iteself) must have a minimum weight of:
- 162 kg for a 1-person team
- 170 kg for a 2-person team
- 210 kg for a 4-person team
The total weight of the bobsled (athletes plus sled) must not exceed:
- 247 kg for a 1-person team
- 390 kg for a 2-person team
- 630 kg for a 4-person team
Return "Eligible" if the team meets all the requirements, or `"Not Eligible"` if the team fails to meet one or more of the requirements.
# --hints--
`check_eligibility([78], 165)` should return `"Eligible"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(check_eligibility([78], 165), "Eligible")`)
}})
```
`check_eligibility([80], 160)` should return `"Not Eligible"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(check_eligibility([80], 160), "Not Eligible")`)
}})
```
`check_eligibility([80], 170)` should return `"Not Eligible"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(check_eligibility([80], 170), "Not Eligible")`)
}})
```
`check_eligibility([85, 90], 170)` should return `"Eligible"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(check_eligibility([85, 90], 170), "Eligible")`)
}})
```
`check_eligibility([85, 95], 168)` should return `"Not Eligible"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(check_eligibility([85, 95], 168), "Not Eligible")`)
}})
```
`check_eligibility([112, 97], 185)` should return `"Not Eligible"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(check_eligibility([112, 97], 185), "Not Eligible")`)
}})
```
`check_eligibility([110, 102, 90, 106], 222)` should return `"Eligible"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(check_eligibility([110, 102, 90, 106], 222), "Eligible")`)
}})
```
`check_eligibility([106, 99, 90, 88], 205)` should return `"Not Eligible"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(check_eligibility([106, 99, 90, 88], 205), "Not Eligible")`)
}})
```
`check_eligibility([106, 99, 103, 96], 227)` should return `"Not Eligible"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(check_eligibility([106, 99, 103, 96], 227), "Not Eligible")`)
}})
```
# --seed--
## --seed-contents--
```py
def check_eligibility(athlete_weights, sled_weight):
return athlete_weights
```
# --solutions--
```py
def check_eligibility(athlete_weights, sled_weight):
team_size = len(athlete_weights)
rules = {
1: {"min_sled": 162, "max_total": 247},
2: {"min_sled": 170, "max_total": 390},
4: {"min_sled": 210, "max_total": 630}
}
min_sled = rules[team_size]["min_sled"]
max_total = rules[team_size]["max_total"]
total_weight = sum(athlete_weights) + sled_weight
if sled_weight < min_sled:
return "Not Eligible"
if total_weight > max_total:
return "Not Eligible"
return "Eligible"
```

View File

@@ -0,0 +1,71 @@
---
id: 697a49e9860d24853adef67d
title: "Challenge 192: 2026 Winter Games Day 13: Nordic Combined"
challengeType: 29
dashedName: challenge-192
---
# --description--
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.
# --hints--
`calculate_start_delays([120, 110, 125])` should return `[8, 23, 0]`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(calculate_start_delays([120, 110, 125]), [8, 23, 0])`)
}})
```
`calculate_start_delays([118, 125, 122, 120])` should return `[11, 0, 5, 8]`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(calculate_start_delays([118, 125, 122, 120]), [11, 0, 5, 8])`)
}})
```
`calculate_start_delays([100, 105, 95, 110, 120, 115, 108])` should return `[30, 23, 38, 15, 0, 8, 18]`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(calculate_start_delays([100, 105, 95, 110, 120, 115, 108]), [30, 23, 38, 15, 0, 8, 18])`)
}})
```
`calculate_start_delays([130, 125, 128, 120, 118, 122, 127, 115, 132, 124])` should return `[3, 11, 6, 18, 21, 15, 8, 26, 0, 12]`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(calculate_start_delays([130, 125, 128, 120, 118, 122, 127, 115, 132, 124]), [3, 11, 6, 18, 21, 15, 8, 26, 0, 12])`)
}})
```
# --seed--
## --seed-contents--
```py
def calculate_start_delays(jump_scores):
return jump_scores
```
# --solutions--
```py
import math
def calculate_start_delays(jump_scores):
best_jump = max(jump_scores)
return [math.ceil((best_jump - score) * 1.5) for score in jump_scores]
```

View File

@@ -0,0 +1,139 @@
---
id: 697a49e9860d24853adef67e
title: "Challenge 193: 2026 Winter Games Day 14: Ski Mountaineering"
challengeType: 29
dashedName: challenge-193
---
# --description--
Given the snow depth and slope of a mountain, determine if there's an avalanche risk.
- The snow depth values are `"Shallow"`, `"Moderate"`, or `"Deep"`.
- Slope values are `"Gentle"`, `"Steep"`, or `"Very Steep"`.
Return `"Safe"` or `"Risky"` based on this table:
| |`"Shallow"`|`"Moderate"`|`"Deep"`|
|-|-|-|-|
|`"Gentle"`|`"Safe"`|`"Safe"`|`"Safe"`|
|`"Steep"`|`"Safe"`|`"Risky"`|`"Risky"`|
|`"Very Steep"`|`"Safe"`| `"Risky"`|`"Risky"`|
# --hints--
`avalanche_risk("Shallow", "Gentle")` should return `"Safe"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(avalanche_risk("Shallow", "Gentle"), "Safe")`)
}})
```
`avalanche_risk("Shallow", "Steep")` should return `"Safe"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(avalanche_risk("Shallow", "Steep"), "Safe")`)
}})
```
`avalanche_risk("Shallow", "Very Steep")` should return `"Safe"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(avalanche_risk("Shallow", "Very Steep"), "Safe")`)
}})
```
`avalanche_risk("Moderate", "Gentle")` should return `"Safe"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(avalanche_risk("Moderate", "Gentle"), "Safe")`)
}})
```
`avalanche_risk("Moderate", "Steep")` should return `"Risky"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(avalanche_risk("Moderate", "Steep"), "Risky")`)
}})
```
`avalanche_risk("Moderate", "Very Steep")` should return `"Risky"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(avalanche_risk("Moderate", "Very Steep"), "Risky")`)
}})
```
`avalanche_risk("Deep", "Gentle")` should return `"Safe"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(avalanche_risk("Deep", "Gentle"), "Safe")`)
}})
```
`avalanche_risk("Deep", "Steep")` should return `"Risky"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(avalanche_risk("Deep", "Steep"), "Risky")`)
}})
```
`avalanche_risk("Deep", "Very Steep")` should return `"Risky"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(avalanche_risk("Deep", "Very Steep"), "Risky")`)
}})
```
# --seed--
## --seed-contents--
```py
def avalanche_risk(snow_depth, slope):
return snow_depth
```
# --solutions--
```py
def avalanche_risk(snow_depth, slope):
risk_table = {
"Gentle": {
"Shallow": "Safe",
"Moderate": "Safe",
"Deep": "Safe",
},
"Steep": {
"Shallow": "Safe",
"Moderate": "Risky",
"Deep": "Risky",
},
"Very Steep": {
"Shallow": "Safe",
"Moderate": "Risky",
"Deep": "Risky",
},
}
return risk_table[slope][snow_depth]
```

View File

@@ -0,0 +1,125 @@
---
id: 697a49e9860d24853adef67f
title: "Challenge 194: 2026 Winter Games Day 15: Freestyle Skiing"
challengeType: 29
dashedName: challenge-194
---
# --description--
Given a trick name consisting of two words, determine if it is a valid freestyle skiing trick name.
A trick is valid if the first word is in the list of valid first words, and the second word is in the list of valid second words.
- The two words will be separated by a single space.
Valid first words:
|`"Misty"`|
|-|
|`"Ghost"`|
|`"Thunder"`|
|`"Solar"`|
|`"Sky"`|
|`"Phantom"`|
|`"Frozen"`|
|`"Polar"`|
Valid second words:
|`"Twister"`|
|-|
|`"Icequake"`|
|`"Avalanche"`|
|`"Vortex"`|
|`"Snowstorm"`|
|`"Frostbite"`|
|`"Blizzard"`|
|`"Shadow"`|
# --hints--
`is_valid_trick("Polar Vortex")` should return `True`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_valid_trick("Polar Vortex"), True)`)
}})
```
`is_valid_trick("Solar Icequake")` should return `True`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_valid_trick("Solar Icequake"), True)`)
}})
```
`is_valid_trick("Thunder Blizzard")` should return `True`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_valid_trick("Thunder Blizzard"), True)`)
}})
```
`is_valid_trick("Phantom Frostbite")` should return `True`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_valid_trick("Phantom Frostbite"), True)`)
}})
```
`is_valid_trick("Ghost Avalanche")` should return `True`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_valid_trick("Ghost Avalanche"), True)`)
}})
```
`is_valid_trick("Snowstorm Shadow")` should return `False`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_valid_trick("Snowstorm Shadow"), False)`)
}})
```
`is_valid_trick("Solar Sky")` should return `False`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_valid_trick("Solar Sky"), False)`)
}})
```
# --seed--
## --seed-contents--
```py
def is_valid_trick(trick_name):
return trick_name
```
# --solutions--
```py
def is_valid_trick(trick_name):
valid_first = ["Misty", "Ghost", "Thunder", "Solar", "Sky", "Phantom", "Frozen", "Polar"]
valid_second = ["Twister", "Icequake", "Avalanche", "Vortex", "Snowstorm", "Frostbite", "Blizzard", "Shadow"]
words = trick_name.split(" ")
first, second = words
return first in valid_first and second in valid_second
```

View File

@@ -0,0 +1,151 @@
---
id: 697a49e9860d24853adef680
title: "Challenge 195: 2026 Winter Games Day 16: Curling"
challengeType: 29
dashedName: challenge-195
---
# --description--
Given a 5x5 matrix representing the "house" at the end of a curling round, determine which team scores and how many points they score.
The layout:
- The center cell (index `[2, 2]`) is the "button".
- The 8 cells directly surrounding the button represent ring 1.
- And the 16 cells on the outer edge of the house represent ring 2.
In the given matrix:
- `"."` represents an empty space.
- `"R"` represents a space with a red stone.
- `"Y"` represents a space with a yellow stone.
Scoring rules:
- Only one team can score per round.
- The team with the stone closest to the button scores.
- The scoring team earns 1 point for each of their stones that is closer to the button than the opponent's closest stone.
- The lower the ring number, the closer to the center the stone is.
- If both teams' closest stone is the same distance from the center, no team scores.
Return:
- A string in the format `"team: number_of_points"`. e.g: `"R: 2"`.
- or `"No points awarded"` if neither team scored any points.
For example, given:
```js
[
[".", ".", "R", ".", "."],
[".", "R", ".", ".", "."],
["Y", ".", ".", ".", "."],
[".", "R", ".", ".", "."],
[".", ".", ".", ".", "."]
]
```
Return `"R: 2"`. The two red stones in ring 1 are tied for the closest and are the only two stones closer than yellows closest.
# --hints--
`score_curling([[".", ".", "R", ".", "."], [".", "R", ".", ".", "."], ["Y", ".", ".", ".", "."], [".", "R", ".", ".", "."], [".", ".", ".", ".", "."]])` should return `"R:2"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(score_curling([[".", ".", "R", ".", "."], [".", "R", ".", ".", "."], ["Y", ".", ".", ".", "."], [".", "R", ".", ".", "."], [".", ".", ".", ".", "."]]), "R: 2")`)
}})
```
`score_curling([[".", ".", "R", ".", "."], [".", ".", ".", ".", "."], [".", ".", "Y", ".", "R"], [".", ".", "Y", "Y", "."], [".", "Y", "R", "R", "."]])` should return `"Y: 3"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(score_curling([[".", ".", "R", ".", "."], [".", ".", ".", ".", "."], [".", ".", "Y", ".", "R"], [".", ".", "Y", "Y", "."], [".", "Y", "R", "R", "."]]), "Y: 3")`)
}})
```
`score_curling([[".", "R", "Y", ".", "."], ["Y", ".", ".", ".", "."], [".", ".", ".", ".", "."], [".", "Y", "R", "Y", "."], [".", ".", "R", "R", "."]])` should return `"No points awarded"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(score_curling([[".", "R", "Y", ".", "."], ["Y", ".", ".", ".", "."], [".", ".", ".", ".", "."], [".", "Y", "R", "Y", "."], [".", ".", "R", "R", "."]]), "No points awarded")`)
}})
```
`score_curling([[".", "Y", "Y", ".", "."], ["Y", ".", ".", "R", "."], [".", ".", "R", ".", "."], [".", ".", "R", "R", "."], [".", "Y", "R", "Y", "."]])` should return `"R: 4"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(score_curling([[".", "Y", "Y", ".", "."], ["Y", ".", ".", "R", "."], [".", ".", "R", ".", "."], [".", ".", "R", "R", "."], [".", "Y", "R", "Y", "."]]), "R: 4")`)
}})
```
`score_curling([["Y", "Y", "Y", "Y", "Y"], ["Y", "R", "R", "R", "Y"], ["Y", "R", "Y", "R", "Y"], ["Y", "R", "R", "R", "Y"], ["Y", "Y", "Y", "Y", "Y"]])` should return `"Y: 1"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(score_curling([["Y", "Y", "Y", "Y", "Y"], ["Y", "R", "R", "R", "Y"], ["Y", "R", "Y", "R", "Y"], ["Y", "R", "R", "R", "Y"], ["Y", "Y", "Y", "Y", "Y"]]), "Y: 1")`)
}})
```
`score_curling([["Y", "R", "Y", "R", "Y"], ["R", ".", ".", ".", "R"], ["Y", ".", ".", ".", "Y"], ["R", ".", ".", ".", "R"], ["Y", ".", ".", "R", "Y"]])` should return `"No points awarded"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(score_curling([["Y", "R", "Y", "R", "Y"], ["R", ".", ".", ".", "R"], ["Y", ".", ".", ".", "Y"], ["R", ".", ".", ".", "R"], ["Y", ".", ".", "R", "Y"]]), "No points awarded")`)
}})
```
# --seed--
## --seed-contents--
```py
def score_curling(house):
return house
```
# --solutions--
```py
def score_curling(house):
stones = {'R': [], 'Y': []}
for i in range(5):
for j in range(5):
cell = house[i][j]
if cell == 'R' or cell == 'Y':
distance = max(abs(i - 2), abs(j - 2))
stones[cell].append(distance)
red_closest = min(stones['R']) if stones['R'] else float('inf')
yellow_closest = min(stones['Y']) if stones['Y'] else float('inf')
if red_closest == float('inf') and yellow_closest == float('inf'):
return "No points awarded"
if red_closest == yellow_closest:
return "No points awarded"
if red_closest < yellow_closest:
winner = 'R'
opponent_closest = yellow_closest
winning_stones = stones['R']
else:
winner = 'Y'
opponent_closest = red_closest
winning_stones = stones['Y']
points = sum(1 for d in winning_stones if d < opponent_closest)
return "No points awarded" if points == 0 else f"{winner}: {points}"
```

View File

@@ -0,0 +1,147 @@
---
id: 697a49e9860d24853adef681
title: "Challenge 196: 2026 Winter Games Day 17: Closing Day"
challengeType: 29
dashedName: challenge-196
---
# --description--
Given a 2D array of medal winners, return a medal count for each country as a CSV string.
- In the given array, each sub-array represents a single event: `[gold_winner, silver_winner, bronze_winner]`
- The returned CSV string should have the following format, with the first line being headers:
```sh
Country,Gold,Silver,Bronze,Total
country_name,gold_count,silver_count,bronze_count,total_medals
```
- Separate new lines with the new line character (`"\n"`).
- Do not include spaces around commas or at the end of lines.
- Sort the returned CSV by gold medal count, highest first. If two countries have the same gold medal count, sort the tied ones alphabetically.
For example, given:
```js
[
["USA", "CAN", "NOR"],
["NOR", "USA", "CAN"],
["USA", "NOR", "SWE"]
]
```
Return:
```sh
"Country,Gold,Silver,Bronze,Total\nUSA,2,1,0,3\nNOR,1,1,1,3\nCAN,0,1,1,2\nSWE,0,0,1,1"
```
Which looks like this when printed:
```sh
Country,Gold,Silver,Bronze,Total
USA,2,1,0,3
NOR,1,1,1,3
CAN,0,1,1,2
SWE,0,0,1,1
```
# --hints--
`count_medals([["USA", "CAN", "NOR"], ["NOR", "USA", "CAN"], ["USA", "NOR", "SWE"]])` should return `"Country,Gold,Silver,Bronze,Total\nUSA,2,1,0,3\nNOR,1,1,1,3\nCAN,0,1,1,2\nSWE,0,0,1,1"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(count_medals([["USA", "CAN", "NOR"], ["NOR", "USA", "CAN"], ["USA", "NOR", "SWE"]]), "Country,Gold,Silver,Bronze,Total\\nUSA,2,1,0,3\\nNOR,1,1,1,3\\nCAN,0,1,1,2\\nSWE,0,0,1,1")`)
}})
```
`count_medals([["NOR","SWE","FIN"]])` should return `"Country,Gold,Silver,Bronze,Total\nNOR,1,0,0,1\nFIN,0,0,1,1\nSWE,0,1,0,1"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(count_medals([["NOR","SWE","FIN"]]), "Country,Gold,Silver,Bronze,Total\\nNOR,1,0,0,1\\nFIN,0,0,1,1\\nSWE,0,1,0,1")`)
}})
```
`count_medals([["ITA", "CHN", "CHN"], ["JPN", "ITA", "JPN"]])` should return `"Country,Gold,Silver,Bronze,Total\nITA,1,1,0,2\nJPN,1,0,1,2\nCHN,0,1,1,2"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(count_medals([["ITA", "CHN", "CHN"], ["JPN", "ITA", "JPN"]]), "Country,Gold,Silver,Bronze,Total\\nITA,1,1,0,2\\nJPN,1,0,1,2\\nCHN,0,1,1,2")`)
}})
```
`count_medals([["USA","CAN","NOR"], ["GER","FRA","ITA"], ["JPN","KOR","CHN"], ["SWE","FIN","NOR"], ["CAN","USA","SWE"], ["FRA","GER","ITA"]])` should return `"Country,Gold,Silver,Bronze,Total\nCAN,1,1,0,2\nFRA,1,1,0,2\nGER,1,1,0,2\nJPN,1,0,0,1\nSWE,1,0,1,2\nUSA,1,1,0,2\nCHN,0,0,1,1\nFIN,0,1,0,1\nITA,0,0,2,2\nKOR,0,1,0,1\nNOR,0,0,2,2"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(count_medals([["USA","CAN","NOR"], ["GER","FRA","ITA"], ["JPN","KOR","CHN"], ["SWE","FIN","NOR"], ["CAN","USA","SWE"], ["FRA","GER","ITA"]]), "Country,Gold,Silver,Bronze,Total\\nCAN,1,1,0,2\\nFRA,1,1,0,2\\nGER,1,1,0,2\\nJPN,1,0,0,1\\nSWE,1,0,1,2\\nUSA,1,1,0,2\\nCHN,0,0,1,1\\nFIN,0,1,0,1\\nITA,0,0,2,2\\nKOR,0,1,0,1\\nNOR,0,0,2,2")`)
}})
```
`count_medals([["ESP","ITA","FRA"], ["ITA","ESP","GER"], ["NOR","SWE","FIN"], ["FIN","NOR","SWE"], ["USA","CAN","MEX"], ["CAN","USA","MEX"], ["JPN","KOR","CHN"], ["CHN","JPN","KOR"]])` should return `"Country,Gold,Silver,Bronze,Total\nCAN,1,1,0,2\nCHN,1,0,1,2\nESP,1,1,0,2\nFIN,1,0,1,2\nITA,1,1,0,2\nJPN,1,1,0,2\nNOR,1,1,0,2\nUSA,1,1,0,2\nFRA,0,0,1,1\nGER,0,0,1,1\nKOR,0,1,1,2\nMEX,0,0,2,2\nSWE,0,1,1,2"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(count_medals([["ESP","ITA","FRA"], ["ITA","ESP","GER"], ["NOR","SWE","FIN"], ["FIN","NOR","SWE"], ["USA","CAN","MEX"], ["CAN","USA","MEX"], ["JPN","KOR","CHN"], ["CHN","JPN","KOR"]]), "Country,Gold,Silver,Bronze,Total\\nCAN,1,1,0,2\\nCHN,1,0,1,2\\nESP,1,1,0,2\\nFIN,1,0,1,2\\nITA,1,1,0,2\\nJPN,1,1,0,2\\nNOR,1,1,0,2\\nUSA,1,1,0,2\\nFRA,0,0,1,1\\nGER,0,0,1,1\\nKOR,0,1,1,2\\nMEX,0,0,2,2\\nSWE,0,1,1,2")`)
}})
```
`count_medals([["USA","CAN","GER"], ["NOR","SWE","FIN"], ["USA","NOR","SWE"], ["GER","FRA","ITA"], ["JPN","KOR","CHN"], ["USA","GER","CAN"], ["SWE","NOR","FIN"], ["CAN","USA","NOR"], ["FRA","GER","ITA"], ["JPN","CHN","KOR"], ["SWE","FIN","NOR"], ["GER","ITA","FRA"]])` should return `"Country,Gold,Silver,Bronze,Total\nUSA,3,1,0,4\nGER,2,2,1,5\nJPN,2,0,0,2\nSWE,2,1,1,4\nCAN,1,1,1,3\nFRA,1,1,1,3\nNOR,1,2,2,5\nCHN,0,1,1,2\nFIN,0,1,2,3\nITA,0,1,2,3\nKOR,0,1,1,2"`.
```js
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(count_medals([["USA","CAN","GER"], ["NOR","SWE","FIN"], ["USA","NOR","SWE"], ["GER","FRA","ITA"], ["JPN","KOR","CHN"], ["USA","GER","CAN"], ["SWE","NOR","FIN"], ["CAN","USA","NOR"], ["FRA","GER","ITA"], ["JPN","CHN","KOR"], ["SWE","FIN","NOR"], ["GER","ITA","FRA"]]), "Country,Gold,Silver,Bronze,Total\\nUSA,3,1,0,4\\nGER,2,2,1,5\\nJPN,2,0,0,2\\nSWE,2,1,1,4\\nCAN,1,1,1,3\\nFRA,1,1,1,3\\nNOR,1,2,2,5\\nCHN,0,1,1,2\\nFIN,0,1,2,3\\nITA,0,1,2,3\\nKOR,0,1,1,2")`)
}})
```
# --seed--
## --seed-contents--
```py
def count_medals(winners):
return winners
```
# --solutions--
```py
def count_medals(winners):
counts = {}
for gold, silver, bronze in winners:
for country, medal_type in [(gold, "Gold"), (silver, "Silver"), (bronze, "Bronze")]:
if country not in counts:
counts[country] = {"Gold": 0, "Silver": 0, "Bronze": 0}
counts[country][medal_type] += 1
countries = [
{
"Country": country,
"Gold": medals["Gold"],
"Silver": medals["Silver"],
"Bronze": medals["Bronze"],
"Total": medals["Gold"] + medals["Silver"] + medals["Bronze"]
}
for country, medals in counts.items()
]
countries.sort(key=lambda c: (-c["Gold"], c["Country"]))
lines = ["Country,Gold,Silver,Bronze,Total"]
for c in countries:
lines.append(f'{c["Country"]},{c["Gold"]},{c["Silver"]},{c["Bronze"]},{c["Total"]}')
return "\n".join(lines)
```

View File

@@ -722,6 +722,74 @@
{
"id": "69738771fb5a7b8b24cca2a5",
"title": "Challenge 179: Pocket Change"
},
{
"id": "697a49e6ff50d756c9b6935d",
"title": "Challenge 180: 2026 Winter Games Day 1: Opening Day"
},
{
"id": "697a49e6ff50d756c9b6935e",
"title": "Challenge 181: 2026 Winter Games Day 2: Snowboarding"
},
{
"id": "697a49e6ff50d756c9b6935f",
"title": "Challenge 182: 2026 Winter Games Day 3: Biathlon"
},
{
"id": "697a49e6ff50d756c9b69360",
"title": "Challenge 183: 2026 Winter Games Day 4: Ski Jumping"
},
{
"id": "697a49e6ff50d756c9b69361",
"title": "Challenge 184: 2026 Winter Games Day 5: Cross-Country Skiing"
},
{
"id": "697a49e6ff50d756c9b69362",
"title": "Challenge 185: 2026 Winter Games Day 6: Figure Skating"
},
{
"id": "697a49e6ff50d756c9b69363",
"title": "Challenge 186: 2026 Winter Games Day 7: Speed Skating"
},
{
"id": "697a49e6ff50d756c9b69364",
"title": "Challenge 187: 2026 Winter Games Day 8: Luge"
},
{
"id": "697a49e6ff50d756c9b69365",
"title": "Challenge 188: 2026 Winter Games Day 9: Skeleton"
},
{
"id": "697a49e6ff50d756c9b69366",
"title": "Challenge 189: 2026 Winter Games Day 10: Alpine Skiing"
},
{
"id": "697a49e9860d24853adef67b",
"title": "Challenge 190: 2026 Winter Games Day 11: Ice Hockey"
},
{
"id": "697a49e9860d24853adef67c",
"title": "Challenge 191: 2026 Winter Games Day 12: Bobsled"
},
{
"id": "697a49e9860d24853adef67d",
"title": "Challenge 192: 2026 Winter Games Day 13: Nordic Combined"
},
{
"id": "697a49e9860d24853adef67e",
"title": "Challenge 193: 2026 Winter Games Day 14: Ski Mountaineering"
},
{
"id": "697a49e9860d24853adef67f",
"title": "Challenge 194: 2026 Winter Games Day 15: Freestyle Skiing"
},
{
"id": "697a49e9860d24853adef680",
"title": "Challenge 195: 2026 Winter Games Day 16: Curling"
},
{
"id": "697a49e9860d24853adef681",
"title": "Challenge 196: 2026 Winter Games Day 17: Closing Day"
}
]
}

View File

@@ -721,6 +721,74 @@
{
"id": "69738771fb5a7b8b24cca2a5",
"title": "Challenge 179: Pocket Change"
},
{
"id": "697a49e6ff50d756c9b6935d",
"title": "Challenge 180: 2026 Winter Games Day 1: Opening Day"
},
{
"id": "697a49e6ff50d756c9b6935e",
"title": "Challenge 181: 2026 Winter Games Day 2: Snowboarding"
},
{
"id": "697a49e6ff50d756c9b6935f",
"title": "Challenge 182: 2026 Winter Games Day 3: Biathlon"
},
{
"id": "697a49e6ff50d756c9b69360",
"title": "Challenge 183: 2026 Winter Games Day 4: Ski Jumping"
},
{
"id": "697a49e6ff50d756c9b69361",
"title": "Challenge 184: 2026 Winter Games Day 5: Cross-Country Skiing"
},
{
"id": "697a49e6ff50d756c9b69362",
"title": "Challenge 185: 2026 Winter Games Day 6: Figure Skating"
},
{
"id": "697a49e6ff50d756c9b69363",
"title": "Challenge 186: 2026 Winter Games Day 7: Speed Skating"
},
{
"id": "697a49e6ff50d756c9b69364",
"title": "Challenge 187: 2026 Winter Games Day 8: Luge"
},
{
"id": "697a49e6ff50d756c9b69365",
"title": "Challenge 188: 2026 Winter Games Day 9: Skeleton"
},
{
"id": "697a49e6ff50d756c9b69366",
"title": "Challenge 189: 2026 Winter Games Day 10: Alpine Skiing"
},
{
"id": "697a49e9860d24853adef67b",
"title": "Challenge 190: 2026 Winter Games Day 11: Ice Hockey"
},
{
"id": "697a49e9860d24853adef67c",
"title": "Challenge 191: 2026 Winter Games Day 12: Bobsled"
},
{
"id": "697a49e9860d24853adef67d",
"title": "Challenge 192: 2026 Winter Games Day 13: Nordic Combined"
},
{
"id": "697a49e9860d24853adef67e",
"title": "Challenge 193: 2026 Winter Games Day 14: Ski Mountaineering"
},
{
"id": "697a49e9860d24853adef67f",
"title": "Challenge 194: 2026 Winter Games Day 15: Freestyle Skiing"
},
{
"id": "697a49e9860d24853adef680",
"title": "Challenge 195: 2026 Winter Games Day 16: Curling"
},
{
"id": "697a49e9860d24853adef681",
"title": "Challenge 196: 2026 Winter Games Day 17: Closing Day"
}
]
}

View File

@@ -13,7 +13,7 @@ const { MONGOHQ_URL } = process.env;
// Number challenges in the dev-playground blocks
// Update this if the number of challenges changes
const EXPECTED_CHALLENGE_COUNT = 179;
const EXPECTED_CHALLENGE_COUNT = 196;
// Date to set for the first challenge, second challenge will be one day later, etc...
// **DO NOT CHANGE THIS AFTER RELEASE (if seeding production - okay for local dev)**