You are given an integer array nums containing unique values.
A maximum binary tree is constructed recursively using the following rules:
Create a root node whose value is the maximum element in nums.
Recursively construct the left subtree using the subarray of elements located to the left of the maximum element.
Recursively construct the right subtree using the subarray of elements located to the right of the maximum element.
Return the root node of the maximum binary tree.
Constraints:
nums.length
nums[i]
All integers in nums are unique.
You are given an integer array nums containing unique values.
A maximum binary tree is constructed recursively using the following rules:
Create a root node whose value is the maximum element in nums.
Recursively construct the left subtree using the subarray of elements located to the left of the maximum element.
Recursively construct the right subtree using the subarray of elements located to the right of the maximum element.
Return the root node of the maximum binary tree.
Constraints:
nums.length
nums[i]
All integers in nums are unique.