solve(nums) receives a sorted array of unique numbers. Build a
height-balanced binary search tree from it and return it serialized level by
level with the provided toLevelOrder helper.
To make the answer unique, use this rule: for the range lo..hi (inclusive) the
root is the element at index Math.floor((lo + hi) / 2) — the lower middle
when the range has an even length. Build the left subtree from the elements before
it and the right subtree from the elements after it.
Examples
solve([-10, -3, 0, 5, 9]) → [0, -10, 5, null, -3, null, 9]
solve([1, 3]) → [1, null, 3]
solve([1, 2, 3]) → [2, 1, 3]
solve([]) → []Sample tests