Problem
Given inorder and postorder traversal of a tree, construct the binary tree.
Example
1 | inorder = [9,3,15,20,7] |
Return the following binary tree:
1 | 3 |
Solution
Method: Divide and Conquer
Time Complexity:
Space Complexity:
1 | # Definition for a binary tree node. |
or
1 | # Definition for a binary tree node |