(Anthorpic)
Implement a FileDedupUtility class to identify duplicate files on a local file system based on their content.
First implement a quick setup_env helper to generate physical test files on disk so you can prove your logic works.
...
Followup1:
What if the files that are significantly larger than the available RAM. What problems we will see? What concerns? Extend your solution to safely identify duplicates.
To handle this case with large files, are you trading off accuracy?
Followup2:
def find_duplicate_files_large(root_path: str, read_limit_bytes: int) -> list[list[str]]:
pass
Here we set a parameter read_limit_bytes to represent the maximum amount of memory your program is allowed to consume per file at any given time.
How would you modify your algorithm to stream and compare these files efficiently without exceeding this memory limit?
...
First implement a quick setup_env helper to generate physical test files on disk so you can prove your logic works.
...
Followup1:
What if the files that are significantly larger than the available RAM. What problems we will see? What concerns? Extend your solution to safely identify duplicates.
To handle this case with large files, are you trading off accuracy?
Followup2:
def find_duplicate_files_large(root_path: str, read_limit_bytes: int) -> list[list[str]]:
pass
Here we set a parameter read_limit_bytes to represent the maximum amount of memory your program is allowed to consume per file at any given time.
How would you modify your algorithm to stream and compare these files efficiently without exceeding this memory limit?
...
Get one-to-one training from Google Facebook engineers
Top-notch Professionals
Learn from Facebook and Google senior engineers interviewed 100+ candidates.
Most recent interview questions and system design topics gathered from aonecode alumnus.
One-to-one online classes. Get feedbacks from real interviewers.
Customized Private Class
Already a coding expert? - Advance straight to hard interview topics of your interest.
New to the ground? - Develop basic coding skills with your own designated mentor.
Days before interview? - Focus on most important problems in target company question bank.