From 456574b2556cc6624bac11c164a69e897621daae Mon Sep 17 00:00:00 2001 From: choiminji Date: Sat, 18 Jul 2026 23:57:54 +0900 Subject: [PATCH] Day19 --- .../609.py" | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 "leetcode3/\354\265\234\353\257\274\354\247\200/609.py" diff --git "a/leetcode3/\354\265\234\353\257\274\354\247\200/609.py" "b/leetcode3/\354\265\234\353\257\274\354\247\200/609.py" new file mode 100644 index 00000000..45299904 --- /dev/null +++ "b/leetcode3/\354\265\234\353\257\274\354\247\200/609.py" @@ -0,0 +1,20 @@ +from collections import defaultdict + +class Solution: + def findDuplicate(self, paths: List[str]) -> List[List[str]]: + content_map = defaultdict(list) + + for path in paths: + parts = path.split() + + directory = parts[0] + + for file in parts[1:]: + filename, content = file.split("(") + content = content[:-1] + + full_path = directory + "/" + filename + content_map[content].append(full_path) + + return [files for files in content_map.values() if len(files) > 1] + \ No newline at end of file