2
public TreeNode constructMaximumBinaryTree(int[] nums) {3
TreeNode root = construct(nums, 0, nums.length - 1);7
private TreeNode construct(int[] nums, int start, int end) {8
if (start > end) return null;9
if (start == end) return new TreeNode(nums[start]);11
int maxIdx = findMax(nums, start, end);12
TreeNode root = new TreeNode(nums[maxIdx]);14
root.left = construct(nums, start, maxIdx - 1);15
root.right = construct(nums, maxIdx + 1, end);20
private int findMax(int[] arr, int low, int high) {21
int idx = -1, max = Integer.MIN_VALUE;22
for (int i = low; i <= high; ++i)