Given a binary tree, return all duplicate subtrees. For each kind of duplicate subtrees, you only need to return the root node of any oneof them.
Two trees are duplicate if they have the same structure with same node values.
Example 1:
1 / 2 3 / / 4 2 4 / 4The following are two duplicate subtrees:
2 / 4and
4Therefore, you need to return above trees‘ root in the form of a list.
s
[LeetCode] Find Duplicate Subtrees 寻找重复树
原文:http://www.cnblogs.com/grandyang/p/7500082.html