[ C++ ] Detail Explain | Diagram
The Idea is As They Given us Inorder and Postorder\n\n \xA0 \xA0as we Know Inorder Fallow --> Left_subtree => Root_Node => Right_subtree Traverse\n \xA0 \xA0ans
The Idea is As They Given us ```Inorder and Postorder```\n\n \xA0 \xA0as we Know Inorder Fallow --> ```Left_subtree => Root_Node => Right_subtree ``` Traverse\n \xA0 \xA0ans \xA0  Postorder Fallow --> ```Left_subtree => Right_subtree =>Root_Node ```traverse\n    using Postorder_array We can Find Root_Node Which always lay in Postorder_array last Possition\n    After Finding That Root_Node ,First we are going to divide Inorder_array Into Two Part  and Postorder  Array \n    into Two part .\n\n    Then We are going to use Both of the arrays left part to Figur Out Left_subtree\n                         and Both of the arraysRigth Part to Figur out Right_subtree\n\n    We are going to recursively do so until One Of the array dose not got empty\n\nLet\'s take an Example \n```\n    inorder   = [4 2 5 1 6 3 7]\n    postorder = [4 5 2 6 7 3 1]\n\n    So root would be 1 here and Left array which lay left of 1 is [4 2 5] and Right of 1 is [6 3 7]\n    so left_inorder_array =  [4 2 5] and right_inorder_arry = [6 3 7]\n\n    using 6 [ which is just rigth of 1] we are going to devide Postorder_array into two part\n    [4 5 2] and [6 7 3]\n\n\n    1st Phase=>        \n\t                   1\n\n                   /        \\\n\n                [4 2 5]   [6 3 7]       <= inorder array\n                [4 5 2]   [6 7 3]       <= postorder array\n\nNow we have new freash problem like need to make tree by using inorder = [4 2 5] && postorder =  [4 5 2] for left subtree \nAND inorder = [6 3 7] && postorder = [6 7 3] for right  subtree \n**now same process we need to do again and again  until One Of the array dose not got empty\nRest of the Process show in a diagram Form :)\n\n    2nd Phase =>\n                           1\n\n                      /        \\\n                     2          3\n                [4]    [5]   [6]   [7]       <= inorder array\n                [4]    [5]   [6]   [7]       <= postorder array\n\n\n3rd Phase =>  \n\t             1\n\n               /    \\\n              2      3\n \n            /  \\    /  \\             <==== Answer\n \n           4    5  6    7 \n```\n\n```\nclass Solution {\npublic:\n    TreeNode *Tree(vector<int>& in, int x, int y,vector<int>& po,int a,int b){\n        if(x > y || a > b)return nullptr;\n        TreeNode *node = new TreeNode(po[b]);\n        int SI = x;  \n        while(node->val != in[SI])SI++;\n        node->left  = Tree(in,x,SI-1,po,a,a+SI-x-1);\n        node->right = Tree(in,SI+1,y,po,a+SI-x,b-1);\n        return node;\n    }\n    TreeNode* buildTree(vector<int>& in, vector<int>& po){\n        return Tree(in,0,in.size()-1,po,0,po.size()-1);\n    }\n};\n```\nIf You Really Like It please **upvote**\nAny doubt Comments Bellow\n**happy Coding :)**
[]