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

118 lines
2.6 KiB
Markdown

---
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'
```