(int[] nums, int l, int r)
| 3 | return construct(nums, 0, nums.length); |
| 4 | } |
| 5 | public TreeNode construct(int[] nums, int l, int r) { |
| 6 | if (l == r) |
| 7 | return null; |
| 8 | int max_i = max(nums, l, r); |
| 9 | TreeNode root = new TreeNode(nums[max_i]); |
| 10 | root.left = construct(nums, l, max_i); |
| 11 | root.right = construct(nums, max_i + 1, r); |
| 12 | return root; |
| 13 | } |
| 14 | public int max(int[] nums, int l, int r) { |
| 15 | int max_i = l; |
| 16 | for (int i = l; i < r; i++) { |
no test coverage detected