@@ -0,0 +1,1553 @@
+import java.util.Arrays;%0Aimport java.util.List;%0Aimport java.util.stream.Collectors;%0A%0Apublic class MaximumBinaryTree %7B%0A%0A    public static void main(String%5B%5D args) %7B%0A        TreeNode treeNode = new MaximumBinaryTree().constructMaximumBinaryTree(new int%5B%5D%7B3, 2, 1, 6, 0, 5%7D);%0A    %7D%0A%0A    public TreeNode constructMaximumBinaryTree(int%5B%5D nums) %7B%0A        return constructMaximumBinaryTree(Arrays.stream(nums).boxed().collect(Collectors.toList()));%0A    %7D%0A%0A    public TreeNode constructMaximumBinaryTree(List%3CInteger%3E nums) %7B%0A        if (nums.isEmpty()) %7B%0A            return null;%0A        %7D%0A        if (nums.size() == 1) %7B%0A            return new TreeNode(nums.get(0));%0A        %7D%0A        int maxValueIndex = 0;%0A        int maxValue = Integer.MIN_VALUE;%0A        for (int i = 0; i %3C nums.size(); i++) %7B%0A            if (nums.get(i) %3E maxValue) %7B%0A                maxValue = nums.get(i);%0A                maxValueIndex = i;%0A            %7D%0A        %7D%0A        TreeNode leftNode = constructMaximumBinaryTree(nums.subList(0, maxValueIndex));%0A        TreeNode rightNode = constructMaximumBinaryTree(nums.subList(maxValueIndex + 1, nums.size()));%0A        return new TreeNode(maxValue, leftNode, rightNode);%0A    %7D%0A%0A    static class TreeNode %7B%0A        int val;%0A        TreeNode left;%0A        TreeNode right;%0A%0A        TreeNode() %7B%0A        %7D%0A%0A        TreeNode(int val) %7B%0A            this.val = val;%0A        %7D%0A%0A        TreeNode(int val, TreeNode left, TreeNode right) %7B%0A            this.val = val;%0A            this.left = left;%0A            this.right = right;%0A        %7D%0A    %7D%0A%0A%7D%0A%0A%0A

Add MaximumBinaryTree