Python solution
My approach: generate a "signature" for each node as:\na(...)c(...)d(...), where the children a, c, d should be sorted.\n... is the signature of grandchildren.\
My approach: generate a "signature" for each node as:\n`a(...)c(...)d(...)`, where the children a, c, d should be sorted.\n`...` is the signature of grandchildren.\n\n```python\nclass Solution:\n    def deleteDuplicateFolder(self, paths: List[List[str]]) -> List[List[str]]:\n        \n        # build the trie\n        trie = {}\n        for path in paths:\n            current = trie\n            for p in path:\n                if p not in current:\n                    current[p] = {}\n                current = current[p]\n        \n        # calculate signature for all nodes on the trie\n        sig_counter = collections.Counter()\n        def dfs(node):\n            sig = []\n            for key in sorted(node.keys()):\n                sig.append(key + "(" + dfs(node[key]) + ")")\n            node[\'#\'] = "".join(sig)\n            if sig:\n                sig_counter[node[\'#\']] += 1\n            return node[\'#\']        \n        dfs(trie)\n        \n        # traverse the trie and keep only sig_counter < 2\n        outputs = []\n        def dfsOutput(node, path):\n            for key in node:\n                if key != \'#\':\n                    sig = node[key][\'#\']\n                    if sig_counter[sig] < 2:\n                        output = path.copy()\n                        output.append(key)\n                        outputs.append(output)\n                        dfsOutput(node[key], output)\n        dfsOutput(trie, [])\n        \n        return outputs\n```\n
['Python']