✔ JAVA | Simple Easy-to-Understand Intuitive Solution
\nclass Solution {\n    public TreeNode buildTree(int[] inorder, int[] postorder) {\n        if (postorder.length == 0 && inorder.length == 0)\n            retu
```\nclass Solution {\n    public TreeNode buildTree(int[] inorder, int[] postorder) {\n        if (postorder.length == 0 && inorder.length == 0)\n            return null;\n        if (postorder.length == 1 && inorder.length == 1)\n            return new TreeNode(inorder[0]);\n        int len = postorder.length;\n        int root = postorder[len - 1];\n        int index = findIndex(inorder, root);\n        \n        int[] leftIn = Arrays.copyOfRange(inorder, 0, index);\n        int[] rightIn = Arrays.copyOfRange(inorder, index + 1, len);\n        \n        int[] leftPost = Arrays.copyOfRange(postorder, 0, index);\n        int[] rightPost = Arrays.copyOfRange(postorder, index, len - 1);\n        \n        TreeNode lroot = buildTree(leftIn, leftPost);\n        TreeNode rroot = buildTree(rightIn, rightPost);\n        \n        return new TreeNode(root, lroot, rroot);\n    }\n    int findIndex(int[] arr, int x) {\n        for (int i = 0; i < arr.length; i++)\n            if (arr[i] == x)\n                return i;\n        return -1;\n    }\n}\n```\nPlease **upvote** :-)
['Recursion', 'Binary Tree', 'Java']