← 返回 anthropic 的题目列表Find Duplicate Files by Content from Directory List
类型:online_judge
anthropic
Coding Problem
Given a directory structure, find all files with duplicate content. The contents of each file can be simplified using a hash function to a string for comparison.
Requirements
Input is a list of strings representing file paths, each containing file contents.
Output the list of files grouped by their content.
Example
Input:
[
"root/a 1.txt(abcd) 2.txt(efgh)",
"root/c 3.txt(abcd)",
"root/c/d 4.txt(efgh)",
"root 4.txt(1234)"
]
Output:
[
["root/a/1.txt", "root/c/3.txt"],
["root/a/2.txt","root/c/d/4.txt"]
]
Constraints
Each input string's length is less than 300.
The number of files is less than 10^4.
Example
Input
["root/a 1.txt(abcd) 2.txt(efgh)"]