95: Convert sorted array into a binary search tree
Given sorted array
in ascending order
, return a height-balanced binary search tree
Note:
height-balanced binary tree
is abinary tree
in which the depth of the two subtrees of every nodenever differs
by more than1
Example 1
Input: [1, 2, 3]
Output: 2
/ \
1 3
Example 2
Input: [0, 1, 2, 3]
Output: 1
/ \
0 2
\
3
Helpful article