Logo
IconChallenge
Icon
IconProblem
IconSolutions
IconSubmissions

Construct Binary Tree from Inorder and Postorder Traversal

XPChallenge Points: 20
levelLevel: Medium

You are given two integer arrays inorder and postorder.


• inorder represents the nodes of a binary tree visited in inorder (left → root → right).
• postorder represents the same tree visited in postorder (left → right → root).


Construct and return the original binary tree.

Example 1:

Input: inorder = [5,2,8,10,7] postorder = [5,8,7,10,2]

Output: [2,5,10,null,null,8,7]

Example 2:

Input: inorder = [4] postorder = [4]

Output: [4]

to Continue
like
dislike

Accepted:

Submission:

IconReport an issue
Icon
IconCode
IconYou need toto run or submitYou need toto run or submit
IconTest Case
IconTest Result