Python Clean Solution
\nclass Trie:\n    def __init__(self):\n        self.children = defaultdict(Trie)\n        self.delete = False\n\nclass Solution:\n    def deleteDuplicateFolder
```\nclass Trie:\n    def __init__(self):\n        self.children = defaultdict(Trie)\n        self.delete = False\n\nclass Solution:\n    def deleteDuplicateFolder(self, paths: List[List[str]]) -> List[List[str]]:\n        root = Trie()\n        patterns = defaultdict(list)\n        ans = []\n\n        self.populate_trie(root, paths)\n        self.generate_patterns(root, patterns)\n        self.update_node_status(patterns)\n        self.generate_valid_paths(root, [], ans)\n        \n        return ans\n        \n    def populate_trie(self, root, paths):\n        for path in sorted(paths):\n            node = root\n            for c in path:\n                node = node.children[c]\n\n    def generate_patterns(self, node, patterns):\n        pattern = f\'({"".join(child + self.generate_patterns(node.children[child], patterns) for child in node.children)})\'\n\n        if pattern != "()":\n            patterns[pattern].append(node)\n\n        return pattern\n\n    def update_node_status(self, patterns):\n        for pattern in patterns:\n            if len(patterns[pattern]) > 1:\n                for node in patterns[pattern]:\n                    node.delete = True\n\n    def generate_valid_paths(self, node, path, ans):\n        if path:\n            ans.append(path[:])\n        \n        for child in node.children:\n            if not node.children[child].delete:\n                self.generate_valid_paths(node.children[child], path + [child], ans)\n```
['Python3']