1
# Runtime: 1004 ms (Top 5.08%) | Memory: 28.1 MB (Top 35.29%)3
def getFolderNames(self, names: List[str]) -> List[str]:4
# Hashmap will store the name as key and the number of times that name has duplicated so fas as value.9
# Check whether the name has already been used11
# Get the number of times the {name} has been used13
# Calculate the next available suffix.14
while modified in hashmap:16
modified = f"{name}({k})"17
# Update the number of times the original {name} is used. This will help to efficiently check for next available suffix if the {name} again comes in future.19
# Store the modified {name} with 0 as it is not duplicated yet.22
# Return the keys of hashmap as that would be the unique file names.