描述
Given a tree, rearrange the tree in in-order so that the leftmost node in the tree is now the root of the tree, and every node has no left child and only 1 right child.
1 | Example 1: |
Note:
- The number of nodes in the given tree will be between 1 and 100.
- Each node will have a unique integer value from 0 to 1000.
分析
中序遍历一颗二叉树。
解决方案1(Java)
1 | /** |