Solve tree distance and design file system
DoorDashSoftware Engineer · OnsiteLast updated
This interview question evaluates algorithm design, data structures, correctness, complexity, edge cases, and implementation details in a realistic interview setting. A strong answer for Solve tree distance and design file system states assumptions, handles edge cases, explains trade-offs, and shows how to validate the result clearly.
Question
Given a binary tree, find the maximum distance between two 'alive' nodes, where 'alive' nodes are initially the leaves; follow-up: allow the set of 'alive' nodes to be specified arbitrarily. LeetCode 1166. Design File System
https://leetcode.com/problems/design-file-system/description/
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.