Your question is LeetCode Data Structures Problem. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
During a security audit of Atlassian Confluence permission policies, repeated policy subtrees may indicate redundant configuration or an unintended copied rule structure. Given a binary policy tree, return the root values of every subtree structure that appears at least twice.
Two subtrees are duplicates when they have the same structure and the same integer value at every corresponding node. Return each duplicate subtree root exactly once, in the order its second occurrence is discovered by postorder traversal. If no duplicate exists, return an empty list.
Implement find_duplicate_subtrees(root). The input root is either None or a nested list in the form [value, left, right], where left and right use the same representation. Return a list of integer root values.
def find_duplicate_subtrees(root):