Morris inorder traversal
Your task
Given a binary tree encoded as a level-order array (None marks a missing child), return its inorder traversal using O(1) extra space (no recursion, no explicit stack) via Morris traversal. You may build the tree nodes from the array, but the traversal itself must use threading: temporarily link each node's inorder predecessor's right pointer to the node, then unlink it on the second visit. Return the list of values in inorder.
Examples
morris_inorder(level: list) -> list[int]Example 1
Input
morris_inorder([1, None, 2, None, 3])Output
[1, 2, 3]