← back to unit
Medium
# queues medium
First Come, First Cookie
The bake sale has exactly c cookies. The line is longer. Tragedy is coming. 🍪
You get the line (front first) and the cookie count c. Print the names that go home cookieless, comma-separated — or everyone fed.
Example:
Input: line = ["mia", "leo", "kai", "ana"], c = 2
Output: kai,ana
The first 2 in line (mia, leo) get cookies, leaving kai and ana cookieless.
💡 need a hint?
q-first-come-cookie.py🔒 given lines are locked — write your code in between
loading...