JAVA solution | 3ms fast | Detailed Explanation
If you found the solution helpful, kindly like and upvote. :)\n\n\nclass Solution {\n    public TreeNode buildTree(int[] inorder, int[] postorder) {\n          
If you found the solution helpful, kindly like and upvote. :)\n\n```\nclass Solution {\n    public TreeNode buildTree(int[] inorder, int[] postorder) {\n            \treturn helper(inorder, postorder, 0, inorder.length-1, postorder.length-1);\n    }\n\n\tTreeNode helper(int[] inorder, int[] postorder, int instart, int inend, int postend) {\n\t\tif(postend<0 ||instart>inend) return null;\n\t\t//The root will always be at the end\n\t\tTreeNode root= new TreeNode(postorder[postend]);\n\t\tint i=instart;\n\t\t//Now we need to find the index in inorder (items on the left are left subtree, right are right subtree)\n\t\tfor(; i<inend; i++)\n\t\t{\n\t\t\tif(inorder[i]==root.val)\n\t\t\t\tbreak;\n\t\t}\n\t\t//Now all that is left is recursing on the left and the right subtree\n\t\troot.left=helper(inorder, postorder, instart, i-1, postend-1+i-inend);\n\t\troot.right=helper(inorder, postorder, i+1, inend, postend-1);\n\t\treturn root;\n    }\n}\n```
[]