Python3 (only 2 lines; explained)
By definition, the postorder input has the root of the tree as its last element.\nAlso, by definition, inorder and postorder have equal lengths.\n\nTherefore, t
By definition, the ```postorder``` input has the root of the tree as its last element.\nAlso, by definition, ```inorder``` and ```postorder``` have equal lengths.\n\nTherefore, to split these inputs into left and right subtrees, we can find the last element of ```postorder``` within ```inorder``` and split ```inorder``` at that point, recursing to the left with the elements left of that point and to the right with the elements to the right of that point.\n\nSince the inputs must be of equal length, we must split ```postorder``` at the same position, but include the element at that position in the input for the right subtree (and, of course, exclude the element in the last position).\n\ne.g. ```inorder = [9,3,15,20,7], postorder = [9,15,7,20,3]```\nThen the root is 3, so ```inorder``` and ```postorder``` are split thusly:\ninorder_left = [9]\ninorder_right = [15,20,7]\npostorder_left = [9]\npostorder_right = [15,7,20]\nThen set the left subtree to ```buildTree(inorder_left, postorder_left)``` and set the right subtree to ```buildTree(inorder_right, postorder_right)```.\n\nSo, here is the resulting algorithm:\nStep 1: If ```inorder``` is not empty, then find the last element of ```postorder``` in ```inorder```.\nStep 2: If ```inorder``` is not empty, then divide the inputs into left and right subtrees and recurse.\n\nAnd here is the code:\n```\n#Runtime: 180 ms, faster than 36.95% of Python3 online submissions for Construct Binary Tree from Inorder and Postorder Traversal.\n#Memory Usage: 88.1 MB, less than 28.00% of Python3 online submissions for Construct Binary Tree from Inorder and Postorder Traversal.\n# Definition for a binary tree node.\n# class TreeNode:\n#     def __init__(self, val=0, left=None, right=None):\n#         self.val = val\n#         self.left = left\n#         self.right = right\nclass Solution:\n    def buildTree(self, inorder: List[int], postorder: List[int]) -> Optional[TreeNode]:\n        pos = inorder.index(postorder[-1]) if inorder else -1\n        return TreeNode(postorder[-1], self.buildTree(inorder[:pos], postorder[:pos]), self.buildTree(inorder[pos+1:], postorder[pos:-1])) if pos>-1 else None\n```
['Recursion', 'Python3']