lintcode73. 前序遍历和中序遍历树构造二叉树
根据前序遍历和中序遍历树构造二叉树. 样例 样例 1 : 输入: [ ] , [ ] 输出: { } 解释: 二叉树为空 样例 2 : 输入: [ 2 , 1 , 3 ] , [ 1 , 2 , 3 ] 输出: { 2 , 1 , 3 } 解释: 二叉树如下 2 / \ 1 3 注意事项 你可以假设树中不存在相同数值的节点 /** * Definition of TreeNode: * class TreeNode { * public: * int val; * TreeNode *left, *right; * TreeNode(int val) { * this->val = val; * this->left = this->right = NULL; * } * } */ class Solution { public : /** *@param preorder : A list of integers that preorder traversal of a tree *@param inorder : A list of integers that inorder traversal of a tree *@return : Root of a tree */ TreeNode * buildTree ( vector < int > & preorder ,