All problems
Foundational·📋 Productivity·Google · Microsoft

Design
Basic Calculator with Undo/Redo

Design a calculator supporting basic arithmetic operations with full undo/redo history of operations.

#OOP#Command Pattern
Start Solving 6F + 2NF requirements inside

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.

01

Implement the Command pattern for reversible actions

02

Manage undo/redo stacks correctly

03

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

Unlock Requirements

05 -  Companies that ask this

You may face this exact question in your next interview.

G
Google
M
Microsoft

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