ByteByteGo logo
menuProblems List

Build Binary Tree From Preorder and Inorder Traversals

Medium

Construct a binary tree using arrays of values obtained after a preorder traversal and an inorder traversal of the tree.

Example:

Input: preorder = [5, 9, 2, 3, 4, 7], inorder = [2, 9, 5, 4, 3, 7]

Constraints:

  • The tree consists of unique values.

You can practice coding exercises online by logging into bytebytego.com on your laptop.