Back to problems

Implement Batched Undo/Redo Layer

Object-Oriented Programming · Google · Hard

Design a document property layer that keeps the current document as a dictionary mapping string keys to string values. The layer must support batched edits with undo and redo. The operations are: beginBatch() starts a batch of edits. setProperty(key, value) sets or overwrites a property in the live document. endBatch() commits the open batch as a single undoable action. undo() reverts the most recently committed batch. redo() reapplies the most recently undone batch. A batch…

Checking your access…