← Harvey Interview Insights

Harvey·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

Did a technical screen for a Software Engineer role at Harvey. The whole thing was one coding problem about building an in-memory file system, which sounds manageable until you get into the deduplication edge cases.

Questions Asked (1)

Q1

Design and implement an in-memory file system class that supports creating files, creating folders, and listing folder contents. File name collisions should be resolved automatically by appending a numbered suffix before the extension, using the smallest positive integer that avoids a conflict.

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

The basic structure clicked pretty fast.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and edge cases, then propose a tree-based data structure with nodes representing files and folders. Implement the core operations (create file, create folder, list contents) with collision resolution using a systematic suffixing algorithm, and discuss trade-offs and potential optimizations.

Pro tip: Demonstrate foresight by discussing how to handle concurrency and persistence, and mention that the collision resolution should be efficient (e.g., using a set for O(1) lookups) to avoid performance bottlenecks.

1. Clarify Requirements and Edge Cases

Ask about expected operations, file naming rules, case sensitivity, path handling, and whether folders can have extensions. Confirm that collisions are resolved by appending a number before the extension.

2. Design Data Structures

Propose a tree structure where each node represents a file or folder. Use a map (dictionary) to store children for O(1) lookup, and include metadata like name, type, and children.

3. Implement Core Operations

Write methods for creating files, creating folders, and listing contents. For file creation, check for name collision and resolve by appending the smallest integer suffix before the extension.

4. Handle Collision Resolution

Explain the algorithm: split the filename into base and extension, then iterate from 1 upward, checking if the new name exists. Use a set or map for efficient existence checks.

5. Discuss Trade-offs and Optimizations

Talk about time/space complexity, potential improvements like caching, concurrency handling, and persistence. Mention alternative approaches like using a trie for prefix searches.

Key Points to Mention

  • Tree-based data structure with nodes for files and folders
  • Efficient collision resolution using a set for O(1) lookups
  • Handling of edge cases: empty names, invalid characters, case sensitivity
  • Time and space complexity of operations (O(1) for creation and listing with map)
  • Concurrency considerations (e.g., thread safety with locks)
  • Extensibility for additional operations like delete, move, or search

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