609. Find Duplicate File in System
class Solution:
def findDuplicate(self, paths: List[str]) -> List[List[str]]:
answer = collections.defaultdict(list)
for path in paths:
directory, *files = path.split()
for f in files:
name, extension = f.split('.')
name = name + '.' + extension[:3]
content = extension[3:]
answer[content].append(directory + '/' + name)
return list(filter(lambda x : len(x) > 1, answer.values()))