← back to unit
Medium
# stacks medium
Checkpoint!
Video game rules: save remembers your score, rollback teleports you to the most recent save (using it up). 💾
You start at score 0. You get events — add:10, save, or rollback (only when a save exists). Print the final score.
Example:
Input: events = ["add:10", "save", "add:5", "rollback"]
Output: 10
The score reaches 10, save remembers 10, add:5 makes it 15, and rollback teleports back to the saved 10.
💡 need a hint?
stk-checkpoint.py🔒 given lines are locked — write your code in between
loading...