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
▲ Console
📱

Install Talent Enrich

Get instant access to jobs and career tools on your device.