Notion Labs interview question

Given a text editor class, write the code for undoing and redoing text operations.