Command executor with undo

0
Remix

Implement a class that executes commands and can undo them: execute(command) applies it and records it, and undo() reverts the most recent command that has not been undone. Decide how a command knows how to reverse itself, then discuss redo, undoing several steps, and the time and memory each operation costs.

NetflixCodingLast asked Apr 2026
No answer yet. Write the first one; the best answer gets endorsed.