leetle

Daily challenge for 2026-07-14

560. Chef Order Stack

Simulate a kitchen order stack. You are given a list of strings actions where each action is one of the following:


  • "cook <dish>": The chef prepares a dish and places it on top of the order stack.

  • "serve": The top dish is served to a customer (removed from the stack and added to the served list).

  • "burn": The top dish is ruined and discarded (removed from stack but not served).


If the stack is empty, "serve" and "burn" actions do nothing.

Return the list of served dishes in the order they were served.

Example:
Input: actions = ["cook pizza", "cook pasta", "serve", "burn", "cook soup", "serve"]
Output: ["pasta", "soup"]

Run this challenge interactively in Python or JavaScript when the app loads.