← back to unit
Medium
# stacks medium
Undo Three Times
Power users don't press undo three times — they type undo:3. 💪
You get actions — action words or undo:N (never undoing more than exists). Print the surviving actions comma-separated, or nothing.
Example:
Input: actions = ["cut", "copy", "paste", "undo:2", "glue"]
Output: cut,glue
cut, copy, paste get pushed. undo:2 pops paste and copy off. Then glue gets pushed — leaving cut,glue.
💡 need a hint?
stk-undo-n.py🔒 given lines are locked — write your code in between
loading...