PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Airtable

Implement spreadsheet undo/redo operations

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's ability to design stateful data structures and manage operation history, focusing on correctness of undo/redo semantics, handling edge cases, and analyzing time and space complexity.

  • medium
  • Airtable
  • Coding & Algorithms
  • Software Engineer

Implement spreadsheet undo/redo operations

Company: Airtable

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

## Problem Design a data structure that simulates **Undo/Redo** for a simplified spreadsheet editor. A user performs a sequence of operations on cells. Each operation changes the value of a single cell. ### Operations - `SET cell value`: set `cell` (e.g., "A1") to `value` (string or number). - `UNDO k`: undo the last `k` successful `SET` operations (or as many as possible). - `REDO k`: redo the last `k` operations that were undone (or as many as possible). ### Rules - `UNDO` and `REDO` affect only `SET` operations. - After an `UNDO`, if a new `SET` is executed, the redo history is cleared. - If `UNDO k` requests more steps than exist, undo all available steps. - If `REDO k` requests more steps than exist, redo all available steps. ### Input/Output (one possible interface) Given a list of commands, return the final mapping of `cell -> value`. ### Example Commands: 1. `SET A1 10` 2. `SET A1 20` 3. `SET B2 5` 4. `UNDO 2` (undo: `B2=5`, then `A1=20`) 5. `REDO 1` (redo: `A1=20`) 6. `SET C1 7` (clears redo stack) Final state: `A1=20`, `C1=7` (and `B2` is empty). ## Constraints - Up to `N` commands (e.g., 10^5). - Aim for efficient per-command time and memory. Discuss the data structures and complexity; implement the core logic.

Quick Answer: This question evaluates a candidate's ability to design stateful data structures and manage operation history, focusing on correctness of undo/redo semantics, handling edge cases, and analyzing time and space complexity.

Related Interview Questions

  • Implement undo/redo with two stacks - Airtable (medium)
  • Count business days excluding holidays - Airtable (medium)
  • Implement BFS serializer and deserializer - Airtable (Medium)
Airtable logo
Airtable
Nov 4, 2025, 12:00 AM
Software Engineer
Onsite
Coding & Algorithms
34
0

Problem

Design a data structure that simulates Undo/Redo for a simplified spreadsheet editor.

A user performs a sequence of operations on cells. Each operation changes the value of a single cell.

Operations

  • SET cell value : set cell (e.g., "A1") to value (string or number).
  • UNDO k : undo the last k successful SET operations (or as many as possible).
  • REDO k : redo the last k operations that were undone (or as many as possible).

Rules

  • UNDO and REDO affect only SET operations.
  • After an UNDO , if a new SET is executed, the redo history is cleared.
  • If UNDO k requests more steps than exist, undo all available steps.
  • If REDO k requests more steps than exist, redo all available steps.

Input/Output (one possible interface)

Given a list of commands, return the final mapping of cell -> value.

Example

Commands:

  1. SET A1 10
  2. SET A1 20
  3. SET B2 5
  4. UNDO 2 (undo: B2=5 , then A1=20 )
  5. REDO 1 (redo: A1=20 )
  6. SET C1 7 (clears redo stack)

Final state: A1=20, C1=7 (and B2 is empty).

Constraints

  • Up to N commands (e.g., 10^5).
  • Aim for efficient per-command time and memory.

Discuss the data structures and complexity; implement the core logic.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Airtable•More Software Engineer•Airtable Software Engineer•Airtable Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.