← Fuse Energy Interview Insights

Fuse Energy·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
Apr 2026Remote

Summary

Fuse Energy had me extend a mini spreadsheet implementation I'd already done, this time adding UNDO functionality. Pretty focused technical round, nothing behavioral, just coding.

Questions Asked (1)

Q1

You have an existing mini spreadsheet that supports Set, Get, and SUM operations. Add an UNDO command that reverts the most recent Set or SUM operation, restoring the affected cell to its previous value and formula state using a history stack.

Algorithms & Data StructuresSystem DesignTechnical Trade-offs
Author's notes

The history stack part sounds obvious in hindsight but I initially tried to just store cell values and forgot that SUM cells also have a formula attached.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the existing data model and operations, then design a history stack that records enough state to revert both values and formulas. Walk through the undo logic for Set and SUM, discussing edge cases like multiple undos and memory trade-offs.

Pro tip: Mention that storing only the delta (previous value and formula) rather than full snapshots keeps memory O(1) per operation, and discuss how you'd handle undo of a SUM that depends on other cells.

1. Clarify requirements and data model

Ask about the spreadsheet's cell representation (value + formula), how SUM is computed, and whether undo should be unlimited or bounded. Confirm that UNDO reverts the most recent Set or SUM, not other operations.

2. Design the history stack

Propose a stack where each entry captures the operation type, the affected cell(s), and the previous state (value and formula). For SUM, record the previous value and formula of the target cell, and note if dependencies changed.

3. Implement UNDO logic

On UNDO, pop the top entry and restore the cell's previous value and formula. If the operation was a SUM, also restore any dependent cells if necessary, or recompute them.

4. Handle edge cases and trade-offs

Discuss empty stack behavior, multiple undos, memory usage, and whether to support redo. Consider if SUM formulas reference other cells and how undo affects them.

5. Test and validate

Walk through a sequence of Set, SUM, and UNDO operations to verify correctness. Mention unit tests for edge cases like undoing after no operations or undoing a SUM that changed multiple cells.

Key Points to Mention

  • History stack as a LIFO structure storing previous state (value and formula) for each operation.
  • For Set: store the cell's previous value and formula; for SUM: store the target cell's previous value and formula, and consider dependencies.
  • Undo should revert both value and formula state, not just the computed value.
  • Memory trade-off: storing full snapshots vs. deltas; prefer deltas for efficiency.
  • Edge cases: empty stack, multiple undos, undoing a SUM that affects other cells, and potential need for redo.
  • Time complexity: O(1) for push/pop, but SUM undo may require O(k) if recomputing dependencies.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.