← Harvey Interview Insights

Harvey·Machine Learning Engineer·Technical Phone Screen·Senior

Senior
Apr 2026

Summary

HarveyAI MLE interview included a spreadsheet design problem I'd seen referenced on 1p3a before, split into at least two parts with the first being a HashMap-based cell read/write implementation.

Questions Asked (1)

Q1

Design a spreadsheet system. Start with basic get_cell and set_cell operations using a HashMap as the underlying storage.

System DesignAlgorithms & Data StructuresData Modeling
Author's notes

Recognized it from a post I'd skimmed before so that helped.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and scale, then design a simple HashMap-based storage for get_cell and set_cell, and iteratively extend to handle formulas, dependencies, and concurrency. Discuss trade-offs and potential optimizations at each step, linking to ML engineering needs like data versioning and feature stores.

Pro tip: Demonstrate awareness of real-world spreadsheet challenges like circular dependencies and concurrent edits, and relate them to ML pipeline issues such as data lineage and reproducibility.

1. Clarify Requirements and Scale

Ask about expected number of cells, concurrent users, formula support, and persistence needs. This sets the stage for design decisions.

2. Design Basic Storage with HashMap

Propose a HashMap mapping cell coordinates (e.g., 'A1') to values. Implement get_cell and set_cell with O(1) average time complexity.

3. Extend to Formulas and Dependencies

Introduce a dependency graph to track cell relationships, enabling formula evaluation and cycle detection. Discuss topological sorting for recalculation.

4. Address Concurrency and Persistence

Consider locking strategies (e.g., fine-grained locks) for concurrent edits, and persistence options like write-ahead logging or snapshots.

5. Optimize and Relate to ML Systems

Discuss optimizations like sparse storage, caching, and incremental computation. Connect to ML use cases such as feature stores and experiment tracking.

Key Points to Mention

  • HashMap provides O(1) average-case get/set, but consider memory overhead and hash collisions.
  • Formula evaluation requires a dependency graph and cycle detection (e.g., DFS or topological sort).
  • Concurrency control: use read-write locks or optimistic concurrency to handle simultaneous edits.
  • Persistence: write-ahead log or periodic snapshots for durability and recovery.
  • Scalability: sharding by row/column or using a distributed store like Redis for large-scale spreadsheets.
  • ML relevance: spreadsheets as feature stores, data versioning, and reproducibility of computations.

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