Given the root of a binary tree, return a list of the root values of all duplicate subtrees. Two subtrees are duplicates if they have the same structure and the same node values. Return each duplicate subtree only once, regardless of how many times it appears.
Example 1:
Input: root = [1,2,3,4,null,2,4,null,null,4]
Output: [4,2]
Explanation: The subtree rooted at 4 appears multiple times, and the subtree rooted at 2 with left child 4 also appears multiple times.
Example 2:
Input: root = [2,1,1]
Output: [1]
Explanation: The two leaf nodes with value 1 form duplicate subtrees.
1 <= number of nodes <= 10^4-200 <= node.val <= 200