Complete the code to find the middle index of the array.
mid = (start + end) [1] 2
We use integer division (//) to get the middle index as an integer.
Complete the code to create a new tree node with the middle element.
node = TreeNode([1][mid])The input array is named nums, so we use nums[mid] to get the middle element.
Fix the error in the recursive call to build the left subtree.
node.left = self.sortedArrayToBST([1], start, mid - 1)
The input array is named nums, so we must pass it in the recursive call.
Fill both blanks to complete the recursive call for the right subtree.
node.right = self.sortedArrayToBST([1], [2], end)
We pass the array nums and the new start index mid + 1 to build the right subtree.
Fill all three blanks to complete the base case and return statement.
if start > [1]: return [2] return [3]
The base case checks if start is greater than end, returns None, otherwise returns the created node.
