Construct Binary Search Tree from Preorder Traversal
MediumLeetCodeAdvanced Trees (BST, LCA, Tree DP)
Approach hintTry it first, then revealHide
Build recursively with an upper bound: the next preorder value belongs to the current subtree only if it is below that bound. Passing bounds avoids searching for split points and gives O(n).