/*** struct TreeNode {* int val;* struct TreeNode *left;* struct TreeNode *right;* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}* };*/
#include <vector>
class Solution {public:/*** 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可*** @param preOrder int整型vector* @param vinOrder int整型vector* @return TreeNode类*/TreeNode* reConstructBinaryTree(vector<int>& preOrder, vector<int>& vinOrder) {// write code hereint n = preOrder.size();if (!n) {return nullptr;} else if (n == 1) {return new TreeNode(preOrder[0]);}auto root = new TreeNode( preOrder[0]);for (int i = 0; i < vinOrder.size(); i++) {if (preOrder[0] == vinOrder[i]) {std::vector<int> leftPreOrder(preOrder.begin() +