[LeetCode] Find Duplicate Subtrees 寻找重复树
Posted Grandyang
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[LeetCode] Find Duplicate Subtrees 寻找重复树相关的知识,希望对你有一定的参考价值。
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 寻找重复树的主要内容,如果未能解决你的问题,请参考以下文章
LeetCode - Find Duplicate Subtrees
[leetcode-652-Find Duplicate Subtrees]
LeetCode 287. Find the Duplicate Number(找重复数字)
[LeetCode] Find Duplicate Subtrees 寻找重复树