NNotion·DSAEngineerTechnical Phone Screen
Implement Undo/Redo for Block Edits
Problem
Implement undo/redo for a sequence of edit operations on a document.
Example
type, delete, format -> undo()/redo() restore state
Constraints
- Bounded history
Approach
Command pattern with two stacks; store inverse operations.
added 6 days ago