{leetcode}/problems/flatten-binary-tree-to-linked-list/[LeetCode - Flatten Binary Tree to Linked List^]
Given a binary tree, flatten it to a linked list in-place.
For example, given the following tree:
1 / \ 2 5 / \ \ 3 4 6
The flattened tree should look like:
1 \ 2 \ 3 \ 4 \ 5 \ 6
这道题本质上来讲可以说是要做一个先根遍历。但是,却可以将这个过程逆向过来,从底向上建立起关联。不可谓不精巧。
思考题:看题解中,可以逐级将左树并入到右树。尝试一下。
link:{sourcedir}/_0114_FlattenBinaryTreeToLinkedList.java[role=include]
link:{sourcedir}/_0114_FlattenBinaryTreeToLinkedList_2.java[role=include]
link:{sourcedir}/_0114_FlattenBinaryTreeToLinkedList_3.java[role=include]