← Harvey AI Interview Insights

Harvey AI·Software Engineer·Technical Phone Screen·Senior

Senior
Jul 2026

Summary

Harvey AI technical screen for a software engineering role, basically one big design question that spiraled into a lot of edge case discussion. Felt like a coding round dressed up as a system design question.

Questions Asked (1)

Q1

Design an in-memory hierarchical file system that supports adding files via absolute paths (creating intermediate directories automatically) and listing a directory's immediate children in sorted order. The system must enforce a max of 5 entries per directory, reject insertions that would exceed it, and auto-rename duplicate filenames by appending a counter before the extension. Describe your data structures, parsing logic, and time/space complexity, and walk through edge cases like root paths, trailing slashes, and invalid inputs.

System DesignAlgorithms & Data StructuresTechnical Trade-offs
Author's notes

This looked like a trie problem at first and I went straight to implementing nodes with a children map.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints, then propose a tree-based data structure (e.g., a trie-like directory node with a map of children) and explain how you'll parse absolute paths, enforce the 5-entry limit, and handle duplicate names with auto-renaming. Walk through edge cases and analyze time/space complexity, emphasizing trade-offs between simplicity and efficiency.

Pro tip: Proactively discuss how you would handle concurrent access and persistence, even though the question focuses on in-memory design—this shows you think beyond the immediate scope and understand real-world system design.

1. Clarify Requirements and Constraints

Ask clarifying questions about path format, allowed characters, case sensitivity, and whether directories count toward the 5-entry limit. Confirm that auto-renaming applies only to files, not directories.

2. Design Data Structures

Propose a tree structure where each node represents a directory and contains a map (or sorted list) of children. Explain how you'll store files vs. directories and maintain sorted order for listing.

3. Outline Parsing and Insertion Logic

Describe how to split the absolute path by '/', traverse from root, create intermediate directories as needed, and handle the final component (file or directory). Detail the duplicate renaming algorithm and the 5-entry limit check.

4. Analyze Complexity and Edge Cases

State time complexity for insertion and listing (e.g., O(k) for path length, O(log n) for sorted insertion) and space complexity. Walk through edge cases: root path '/', trailing slashes, empty path, invalid characters, and exceeding the entry limit.

5. Discuss Trade-offs and Extensions

Mention alternative data structures (e.g., sorted list vs. balanced tree) and their trade-offs. Briefly touch on concurrency, persistence, and scalability if relevant.

Key Points to Mention

  • Use a tree of directory nodes, each with a map or sorted collection of children for O(1) or O(log n) lookups.
  • Parse absolute paths by splitting on '/', ignoring empty segments (handles trailing slashes and root).
  • Enforce the 5-entry limit by checking the size of the children collection before insertion.
  • Auto-rename duplicates by appending a counter before the file extension (e.g., 'file(1).txt'), ensuring uniqueness.
  • Maintain sorted order for listing by using a sorted data structure or sorting on demand.
  • Analyze time complexity: O(k) for path traversal (k = path depth) and O(log n) for insertion if using a balanced tree, or O(n) if using a list.

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