Convert Sorted Array to Binary Search Tree
Given an integer array nums where the elements are sorted in ascending order, convert it to a height-balanced binary search tree.
Convert Sorted Array to Binary Search Tree

Given an integer array nums where the elements are sorted in ascending order, convert it to a height-balanced binary search tree.

Example 1:
Input: {"nums":[-10,-3,0,5,9]}
Output: [0,-3,9,-10,null,5]
Input
arr ={"nums":[-10,-3,0,5,9]}

Processing range [0, 4]

Sorted Array

-10

0

-3

1

0

2

5

3

9

4
left=0right=4

Tree will be built here

Mid Element
Current Range
Outside Range
Variables
No variables to display
DepthFunction Call
Stack empty
0/36