Python with and without dictionary solution
Solution 1:\n\ndef buildTree(self, inorder: List[int], postorder: List[int]) -> Optional[TreeNode]:\n        if inorder:\n            node = TreeNode(postorder[
**Solution 1:**\n```\ndef buildTree(self, inorder: List[int], postorder: List[int]) -> Optional[TreeNode]:\n        if inorder:\n            node = TreeNode(postorder[-1])\n            idx = inorder.index(postorder.pop())\n            node.right = self.buildTree(inorder[idx+1:], postorder)\n            node.left = self.buildTree(inorder[0:idx], postorder)\n            return node\n```\n**Solution 2:**\n```\ndef buildTree(self, inorder: List[int], postorder: List[int]) -> Optional[TreeNode]:\n        dic = {}\n        \n        for idx, val in enumerate(inorder):\n            dic[val] = idx\n        \n        def f(start, end):\n            if start > end:\n                return None\n            node = TreeNode(postorder.pop())\n            index = dic[node.val]\n            node.right = f(index+1, end)\n            node.left = f(start, index-1)\n            return node\n\n        return f(0, len(inorder)-1)\n```
['Python']