Practice Find Duplicate File in System
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Each paths entry begins with a directory path, followed by one or more space-separated file entries of the form filename(content). Group files with identical content and return only groups containing at least two files. Represent each file as directory_path/filename, not as its content or bare name. Both group order and path order may be arbitrary.
Source: Find Duplicate File in System on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
paths = ["root/a 1.txt(abcd) 2.txt(efgh)","root/c 3.txt(abcd)","root/c/d 4.txt(efgh)","root 4.txt(efgh)"]
[["root/a/2.txt","root/c/d/4.txt","root/4.txt"],["root/a/1.txt","root/c/3.txt"]]
# Example 2
paths = ["root/a 1.txt(abcd) 2.txt(efgh)","root/c 3.txt(abcd)","root/c/d 4.txt(efgh)"]
[["root/a/2.txt","root/c/d/4.txt"],["root/a/1.txt","root/c/3.txt"]]
Constraints
Related LeetCode Problems
Practice more problems similar to Find Duplicate File in System.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.