leetcode-889-Construct Binary Tree from Preorder and Postorder Traversal

Get the pattern from it, 1) We know that in pre-order: [root, left, right], in post-order: [left, right, root] 2) so that root + 1 in pre-order must be the root of left subtree, root – 1 in post-order must be the root of right subtree. 3) call a function(pre_root, post_root, size), which get the root of pre and post array, and the size of the function. In the function, find the root of left and right subtree.

Error:
N/A

点赞