0652. Find Duplicate Subtrees
Last updated
Last updated
https://leetcode.com/problems/find-duplicate-subtrees
Given the root
of a binary tree, return all duplicate subtrees.
For each kind of duplicate subtrees, you only need to return the root node of any one of them.
Two trees are duplicate if they have the same structure with the same node values.
Example 1:
Example 2:
Example 3:
Constraints:
The number of the nodes in the tree will be in the range [1, 10^4]
-200 <= Node.val <= 200
serialize subtree as a hash of the tree