← DoorDash Interview InsightsSoftware Engineer

DoorDash·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

DoorDash SWE interview that was basically one long design-and-implement problem around a tree-structured key-value store. More depth than I expected for what sounded like a simple data structure question at first glance.

Questions Asked (1)

Q1

Design and implement a hierarchical key-value store where keys are filesystem-style paths like /a/b/c. The root '/' always exists with value 'root'. Support create(path, value), set(path, value), get(path), and delete(path), where delete only works on leaf nodes and root is undeletable. Model it as a tree internally and discuss complexity per operation.

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

This one took me a minute to fully scope out.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and edge cases, then model the store as a tree where each node represents a path segment and holds a value. Implement operations by traversing from the root, and analyze time and space complexity for each operation, noting trade-offs between simplicity and efficiency.

Pro tip: Mention that using a hash map for children (instead of a list) gives O(1) average lookup per segment, but discuss the trade-off with memory overhead and worst-case O(n) if collisions occur. Also, explicitly handle path normalization (e.g., trailing slashes, multiple slashes) to show attention to detail.

1. Clarify requirements and edge cases

Ask about path format (absolute vs relative, trailing slashes), value types, and behavior for invalid operations (e.g., create on existing path, delete non-leaf). Confirm that root is always present and undeletable.

2. Design the tree structure

Propose a Node class with a value and a map of child name to Node. Explain that the root node represents '/' and has value 'root'. Discuss whether to store full paths or just segments.

3. Implement core operations

For create and set, traverse from root, creating intermediate nodes as needed for create, and updating value for set. For get, traverse and return value if path exists. For delete, ensure the node is a leaf and not root, then remove it from its parent's children.

4. Analyze complexity

State that time complexity is O(k) where k is the number of path segments, assuming O(1) average child lookup. Space complexity is O(total number of nodes). Discuss worst-case for hash map collisions.

5. Discuss trade-offs and extensions

Mention alternatives like using a trie or a flat map with sorted keys, and trade-offs in memory vs speed. Consider concurrency, persistence, or versioning if relevant to the role.

Key Points to Mention

  • Tree node structure with children map for O(1) average lookup per segment
  • Path normalization and handling of edge cases (e.g., trailing slashes, empty segments)
  • Time complexity O(k) for all operations, where k is path depth
  • Space complexity O(n) for n total nodes
  • Delete only on leaf nodes and root is undeletable
  • Trade-offs between tree and flat map approaches, and potential for concurrency control

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