Question
Given a binary tree, flatten it to a linked list in-place.
For example,
Given
The flattened tree should look like:
Explanation
分治法,左右子树递归以后,把左右根节点依次排到右边,左边为空即可。
Given a binary tree, flatten it to a linked list in-place.
For example,
Given
The flattened tree should look like:
分治法,左右子树递归以后,把左右根节点依次排到右边,左边为空即可。