PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCareers
|Home/Coding & Algorithms/DoorDash

Design hierarchical path store with create/set/get/remove

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's competency in hierarchical data structures, path parsing, API semantics, error signaling, complexity analysis, and unit testing for implementing a UNIX-style key-value path store.

  • Medium
  • DoorDash
  • Coding & Algorithms
  • Software Engineer

Design hierarchical path store with create/set/get/remove

Company: DoorDash

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Technical Screen

Design a hierarchical key-value path store supporting four operations on UNIX-style absolute paths (e.g., "/a/b"). Implement: 1) create(path, value): create a new node with value; the parent path must already exist (except root "/"), and the path must not already exist. 2) set(path, value): update the value of an existing path; fail if the path does not exist. 3) get(path): retrieve the value stored at path; indicate absence if the path does not exist. 4) remove(path): delete the specified path only if it has no children; otherwise fail. Choose appropriate return types and error signaling for each method (e.g., boolean success flags, exceptions, or optionals) and document your choices. Define assumptions about valid path syntax (no trailing slash except root, segments separated by single "/", non-empty segments) and initial state (root exists and may or may not hold a value, your choice—justify it). Optimize for time/space; explain the data structures you use and the complexity of each operation. Finally, write a minimal but thorough set of unit tests that validate normal behavior and edge cases, including: creating under a missing parent, duplicate create, set on missing path, get on missing path, remove on non-leaf, remove on leaf, operations involving root, and malformed paths.

Quick Answer: This question evaluates a candidate's competency in hierarchical data structures, path parsing, API semantics, error signaling, complexity analysis, and unit testing for implementing a UNIX-style key-value path store.

Related Interview Questions

  • Maximize Chef Assignment Profit - DoorDash (medium)
  • Compute Courier Delivery Pay - DoorDash (easy)
  • Compute Nearest Destination Distances - DoorDash (easy)
  • Count changed nodes between two menu trees - DoorDash (hard)
  • Calculate Daily Driver Pay - DoorDash (hard)
DoorDash logo
DoorDash
Aug 13, 2025, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
1
0

Design a hierarchical key-value path store supporting four operations on UNIX-style absolute paths (e.g., "/a/b"). Implement:

  1. create(path, value): create a new node with value; the parent path must already exist (except root "/"), and the path must not already exist.
  2. set(path, value): update the value of an existing path; fail if the path does not exist.
  3. get(path): retrieve the value stored at path; indicate absence if the path does not exist.
  4. remove(path): delete the specified path only if it has no children; otherwise fail. Choose appropriate return types and error signaling for each method (e.g., boolean success flags, exceptions, or optionals) and document your choices. Define assumptions about valid path syntax (no trailing slash except root, segments separated by single "/", non-empty segments) and initial state (root exists and may or may not hold a value, your choice—justify it). Optimize for time/space; explain the data structures you use and the complexity of each operation. Finally, write a minimal but thorough set of unit tests that validate normal behavior and edge cases, including: creating under a missing parent, duplicate create, set on missing path, get on missing path, remove on non-leaf, remove on leaf, operations involving root, and malformed paths.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More DoorDash•More Software Engineer•DoorDash Software Engineer•DoorDash Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • Careers
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.