Preorder Traversal

Given the root of a binary tree encoded as a level-order array, return the preorder traversal of its nodes. Preorder traversal visits root, then left subtree, then right subtree. For an array index i, the left child is 2*i + 1 and the right child is 2*i + 2 when those indices exist in the array.

Examples
Input: []
Output: []
Hints

Preorder Traversal

Given the root of a binary tree encoded as a level-order array, return the preorder traversal of its nodes. Preorder traversal visits root, then left subtree, then right subtree. For an array index `i`, the left child is `2*i + 1` and the right child is `2*i + 2` when those indices exist in the array.