Capture and externalize an object's internal state so it can be restored later, without violating encapsulation — a text editor's undo stack.
Implement `Editor.save()` (returns an EditorMemento snapshot of the current content) and Editor.restore(memento) (resets content back to that snapshot).
solve(ops) replays { op: 'type', text } | { op: 'save' } | { op: 'undo' } steps and returns the final content — 'undo' restores the most recent save.
solve([{op:'type',text:'Hello'},{op:'save'},{op:'type',text:' World'},{op:'undo'}]) → 'Hello'
Sample tests