Search⌘ K
AI Features

Recover a Tree From Preorder Traversal

Recover a Tree From Preorder Traversal gives you a preorder string where dashes show each node's depth. Reconstruct the original binary tree and return its root; a lone child is always left.

Statement

We perform a preorder depth-first traversal on a binary tree starting from its root.

    ...