Beats 100% Python Solution
\n\nIntuition\nWe need to some way to easily compare content of folders to check if they are identical, and if they are then delete those folders.\n\nIf we can 
![image.png](https://assets.leetcode.com/users/images/1879bda1-6e70-4d2e-b426-0e56814fcdc3_1700952447.0004528.png)\n\n**Intuition**\nWe need to some way to easily compare content of folders to check if they are identical, and if they are then delete those folders.\n\nIf we can make a find a way to serialize the content of a folder and store that content in hash map, it will be really easy group the folders with same content\n\n**Serialization**\n```      \n"a(b(d)c)"\n        a\n      /   \\\n    b       c\n  /\nd\n```\n\n**Solution**\n```\ndef deleteDuplicateFolder(self, paths: List[List[str]]) -> List[List[str]]:\n    tree = {"#": "/"}\n    for path in paths:\n        c_node = tree\n        for node in path:\n            if node not in c_node:\n                c_node[node] = {"#": node}\n            c_node = c_node[node]\n    \n    content_map = defaultdict(list)\n    def mark(c_node, parent):\n        if len(c_node) == 1:\n            return c_node["#"]\n        \n        content = ""\n        for child in sorted(c_node[k]["#"] for k in c_node if k!="#"):\n            if child != "#":\n                content += mark(c_node[child], c_node)\n        content_map[content].append((c_node["#"], parent))\n        return f\'{c_node["#"]}({content})\'\n    mark(tree, {})\n\n    for v in content_map.values():\n        if len(v) > 1:\n            for node, parent in v:\n                del parent[node]\n    \n    remaining_paths = []\n    def create_paths(c_node, c_path):\n        c_path = c_path + [c_node["#"]]\n        remaining_paths.append(c_path)\n        \n        for child in c_node:\n            if child != "#":\n                create_paths(c_node[child], c_path)\n    for k in tree:\n        if k != "#":\n            create_paths(tree[k], [])\n\n    return remaining_paths\n```
['Hash Table', 'String', 'Tree', 'Trie', 'Python']