There was an error while loading. Please reload this page.
2 parents 8288899 + 456574b commit f0605ecCopy full SHA for f0605ec
1 file changed
leetcode3/최민지/609.py
@@ -0,0 +1,20 @@
1
+from collections import defaultdict
2
+
3
+class Solution:
4
+ def findDuplicate(self, paths: List[str]) -> List[List[str]]:
5
+ content_map = defaultdict(list)
6
7
+ for path in paths:
8
+ parts = path.split()
9
10
+ directory = parts[0]
11
12
+ for file in parts[1:]:
13
+ filename, content = file.split("(")
14
+ content = content[:-1]
15
16
+ full_path = directory + "/" + filename
17
+ content_map[content].append(full_path)
18
19
+ return [files for files in content_map.values() if len(files) > 1]
20
0 commit comments