Leetcode Problem 897. Increasing Order Search Tree
897. Increasing Order Search Tree
Leetcode Solutions
In-Order Traversal with Relinking
Initialize a dummy node to act as the previous node in the linked list.
Perform an in-order traversal of the tree.
a. Recursively traverse the left subtree.
b. Relink the previous node's right child to the current node and set the current node's left child to null.
c. Update the previous node to the current node.
d. Recursively traverse the right subtree.
Return the right child of the dummy node, which is the new root of the rearranged tree.