β back to unit
Medium
# queues medium
The Sushi Belt
Plates circle past your seat forever. You're disciplined: you let m-1 plates pass and take every m-th, until you've taken t plates. π£
You get the plates on the belt (in passing order β taken plates leave the belt!), the count m, and how many t you'll take. Print what you take, in order, space-separated.
Example:
Input: plates = ["tuna", "egg", "roll", "salmon", "tofu"], m = 2, t = 3
Output: egg salmon tuna
Letting 1 plate pass (tuna) then taking egg; letting 1 more pass (roll) then taking salmon; letting 1 more pass (tofu, wrapping back to tuna) then taking tuna.
π‘ need a hint?
q-sushi-belt.pyπ given lines are locked β write your code in between
loading...