public TreeNode builder(HashMap<Integer, Integer> map, int[] postorder, int begin, int end, int inBegin, int inEnd) {
        if (begin > end)
            return null;
        int val = postorder[end];
        int index = map.get(val);
        int leftSize = index - inBegin;
        int rightSize = inEnd - index;
        TreeNode root = new TreeNode(val);
        root.left = builder(map, postorder, begin, begin + leftSize - 1, inBegin, index - 1);
        root.right = builder(map, postorder, end - rightSize, end - 1, index + 1, inEnd);
        return root;
    }