← back to unit
Easy
# queues easy
Serve Five
The kitchen prepped exactly k trays — serve that many, then close. 🍽️
You get the line (front first) and the number k (never more than the line's length). Serve k people and print who's still waiting, comma-separated, or all served.
Example:
Input: line = ["mia", "leo", "kai", "ana", "bo"], k = 3
Output: ana,bo
Serving 3 people removes mia, leo, and kai from the front, leaving ana and bo still waiting.
💡 need a hint?
q-serve-five.py🔒 given lines are locked — write your code in between
loading...