← 返回 anthropic 的题目列表Find Duplicate Files
类型:online_judge
Given a list of directory paths with file contents, find all the duplicate files in the system. Each path is represented as 'directory path file1(content1) file2(content2) ...', for example, 'root/a 1.txt(abcd) 2.txt(efgh)'. Implement a function find_duplicate to find all files with the same content. The function should return lists of file paths with the same content. The order does not matter. The number of files won't exceed 2 * 10^4, and the content size is at most 50 characters. Return a list containing all duplicate file paths.
Example
Input
['root/a 1.txt(abcd) 2.txt(efgh)', 'root/c 3.txt(abcd)', 'root/c/d 4.txt(efgh)', 'root 4.txt(efgh)']