Design
Basic Calculator with Undo/Redo
Design a calculator supporting basic arithmetic operations with full undo/redo history of operations.
01 - Why interviewers ask this
It's a compact way to test the Command pattern specifically — interviewers want to see undo/redo implemented with real Command objects, not a hacky history array of raw values.
02 - Where this system exists in the real world
You interact with this design every day.
Spreadsheet and calculator app undo/redo
Text/graphics editors with command history
Financial calculators with audit trails
03 - What you'll master
Solve this once. Know it forever.
Implement the Command pattern for reversible actions
Manage undo/redo stacks correctly
Handle invalid operations (e.g. divide by zero) safely
04 - What you'll design
6 functional · 2 non-functional requirements.
Support add, subtract, multiply, divide operations
5 more requirements inside
Sign in to unlock the full brief and start designing
05 - Companies that ask this
You may face this exact question in your next interview.
Ready?
Open the canvas.
Design it yourself.
See all requirements, use staged hints, run your code, and compare with community discussions - all on the same canvas.
Start Solving