Given the root of a binary tree, flatten the tree into a "linked list": The linked list should use the same TreeNode class.
The right pointer points to the next node, and left is always null. The list should be in preorder. Example: becomes .
Do it in-place using extra space (excluding recursion stack). Constraints: up to nodes, values from to .