You are given the root of a binary tree with voyage representing a target preorder traversal of the binary tree.
Flipping a node means swapping its left and right child subtrees.
Return a list of values of all nodes that were flipped to make the preorder traversal of the tree match voyage. If it is impossible to make the preorder traversal match voyage, return
Constraints:
The number of nodes in the tree is
voyage.length
Node.val, voyage[i]
All the values in the tree are unique.
All the values in voyage are unique.
You are given the root of a binary tree with voyage representing a target preorder traversal of the binary tree.
Flipping a node means swapping its left and right child subtrees.
Return a list of values of all nodes that were flipped to make the preorder traversal of the tree match voyage. If it is impossible to make the preorder traversal match voyage, return
Constraints:
The number of nodes in the tree is
voyage.length
Node.val, voyage[i]
All the values in the tree are unique.
All the values in voyage are unique.