The Codetikki archivists received a sorted list of scroll IDs and want to build a height-balanced binary search tree from it. Given a sorted array of integers, convert it to a height-balanced BST. Output the level-order traversal of the resulting BST (with "null" for absent nodes). Input: first line n, second line n sorted integers. Output: level-order traversal.
Example 1:
Example 2:
Constraints:
1 <= n <= 10^4 -10^9 <= arr[i] <= 10^9 Array is sorted in ascending order
Tags:
