# queues medium

Musical Chairs

Each round the music plays some number of beats; the circle rotates one kid per beat, and when it stops, whoever's at the front is out. 🎵

You get the names and the beats for each round (exactly enough rounds to leave one winner). Print the winner.

Example:

Input: names = ["mia", "leo", "kai", "ana"], beats = [2, 0, 3] Output: mia

Round 1's 2 beats rotate the circle twice before eliminating the new front; round 2's 0 beats eliminates whoever's currently front without moving; round 3's 3 beats rotate again before the last elimination — mia is the one left standing.

💡 need a hint?

q-musical-chairs.py🔒 given lines are locked — write your code in between
loading...