construct(nums, l, r) that takes a subarray defined by indices l and r.l == r, return None as there are no elements to form a tree.max_i of the maximum element in the subarray nums[l:r].root with the value nums[max_i].construct(nums, l, max_i) and assign it to root.left.construct(nums, max_i + 1, r) and assign it to root.right.root node.