Smallest String Starting From a Leaf

Asked at Amazon · Coding Questions · Difficulty: Medium

Given a binary tree (level-order list, `None` for missing children) whose node values are `0..25` (letters `'a'..'z'`), return the lexicographically smallest string formed by any leaf-to-root path.

Loading the problem…