1948. Delete Duplicate Folders in System
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```python3 []
from collections import defaultdict
from typing import List

class Directory:
    def __init__(self):
        self.subdirectories = defaultdict(Directory)
        self.marked_for_deletion = False

class Solution:
    def deleteDuplicateFolder(self, paths: List[List[str]]) -> List[List[str]]:
        def get_signature(directory):
            signature = "(" + "".join(subdir + get_signature(directory.subdirectories[subdir]) for subdir in directory.subdirectories) + ")"
            if signature != "()":
                signature_map[signature].append(directory)
            return signature
        
        def collect_unique_paths(directory, current_path):
            for subdir in directory.subdirectories:
                if not directory.subdirectories[subdir].marked_for_deletion:
                    collect_unique_paths(directory.subdirectories[subdir], current_path + [subdir])
            if current_path:
                result_paths.append(current_path[:])
        
        signature_map, root_directory, result_paths = defaultdict(list), Directory(), []
        
        for path in sorted(paths):
            current_directory = root_directory
            for part in path:
                current_directory = current_directory.subdirectories[part]
        
        get_signature(root_directory)
        
        for directories in signature_map.values():
            if len(directories) > 1:
                for directory in directories:
                    directory.marked_for_deletion = True
        
        collect_unique_paths(root_directory, [])
        return result_paths

```
['Python3']