6 kyu
Penguin Olympics: Swimming Race Disaster
313 of 672mrbenbot
Description:
Penguin Olympics: Swimming Race Disaster
The situation...
- The fastest penguins in the world have just swum for the ultimate prize in professional penguin swimming.
- The cameras that were capturing the race stopped recording half way through.
- The athletes, and the fans are in disarray waiting for the results.
The challenge...
Given the last recorded frame of the race, and an array of penguin athletes, work out the gold, silver and bronze medal positions.
The rules...
- Assume all penguins swim at the same speed, when swimming through the same kind of water (waves or smooth water).
- Waves (
~
) take twice as long to swim through as smooth water (-
). - Penguins (
p
orP
) are racing from left to right. - There can be any number of lanes, and the race can be any length.
- All Lanes in a single race will be the same length.
- Penguin names are in the same order as the lanes.
- Return a string in this format:
"GOLD: <name-1>, SILVER: <name-2>, BRONZE: <name-3>"
- There will always be an equal amount of penguins and lanes.
- There will always be a top three (no draws).
Examples...
Snapshot:
|----p---~---------|
|----p---~~--------|
|----p---~~~-------|
Penguins:
["Derek", "Francis", "Bob"]
Expected Output:
"GOLD: Derek, SILVER: Francis, BRONZE: Bob"
Snapshot:
|-~~------------~--P-------|
|~~--~P------------~-------|
|--------~-P---------------|
|--------~-P----~~~--------|
Penguins:
["Joline", "Abigail", "Jane", "Gerry"]
Expected Output:
"GOLD: Joline, SILVER: Jane, BRONZE: Gerry"
Puzzles
Similar Kata:
Stats:
Created | Feb 9, 2021 |
Published | Feb 9, 2021 |
Warriors Trained | 1372 |
Total Skips | 25 |
Total Code Submissions | 3125 |
Total Times Completed | 672 |
JavaScript Completions | 313 |
C# Completions | 67 |
Python Completions | 303 |
Julia Completions | 10 |
Total Stars | 34 |
% of votes with a positive feedback rating | 94% of 176 |
Total "Very Satisfied" Votes | 157 |
Total "Somewhat Satisfied" Votes | 16 |
Total "Not Satisfied" Votes | 3 |
Total Rank Assessments | 14 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 8 kyu |