← back to unit
Easy
# queues easy
The Lunch Line
The lunch line has one sacred law: first in, first out. No cutting. Ever. 🥪
You get commands — join:name (joins the back) or serve (front person gets lunch; always someone there). Print the names in the order they were served, space-separated.
Example:
Input: commands = ["join:mia", "join:leo", "serve", "join:kai", "serve", "serve"]
Output: mia leo kai
serve always takes whoever is at the front. Mia joined first so she's served first, then leo, then kai — in the order they joined.
💡 need a hint?
q-lunch-line.py🔒 given lines are locked — write your code in between
loading...