Convert Sorted Array to BST
Easy
Trees
Array
Tree
BST
Given sorted array, output level-order of a height-balanced BST.
Constraints
1 ≤ len ≤ 10^4
Examples
Example 1:
Input: -10 -3 0 5 9
Output: 0 -3 9 -10 null 5
Example 2:
Input: 1 3
Output: 3 1
Tests:
Runtime:
Memory:
Test
Input:
Expected:
Got:
Click Run Code to test against sample cases, or Submit to test against all cases.
▲ Console