← back to unit
Medium
# queues medium
The Elimination Rhyme
Eeny, meeny, miny, moe — the rhyme decides who's out! One word per kid, and the kid on the LAST word leaves the circle. 🎶
You get the names and the rhyme (space-separated words). Rounds continue until one kid remains. Print the champion.
Example:
Input: names = ["mia", "leo", "kai", "ana"], rhyme = "eeny meeny miny moe"
Output: leo
The rhyme has 4 words, so k = 4 — the kid landing on the 4th word each round is eliminated, round after round, until only leo survives.
💡 need a hint?
q-elimination-rhyme.py🔒 given lines are locked — write your code in between
loading...