Editing with undo (Notes App)

Add edit <id <line number <text (note <id line <k edited; error: no line <k), undo <id (restores the lines as they were before the last write or edit: note <id: undone (<n lines), or error: nothing to undo) and history <id (note <id: <k versions, counting the current one).

Input: As before.

Output: As before.

Difficulty: Medium. Write your answer in the browser editor, run the examples, then submit it against hidden tests. Python and JavaScript are free; other languages are part of licode Club.

Hint

  • Before every change, push a copy of the lines onto a stack of versions.

More Notes App practice