Limited Time Offer:Up to 20% off Hello Interview Premium
Up to 20% off Hello Interview Premium 🎉
Hello Interview
Your Dashboard
System Design
Code
Low Level Design
Behavioral
AI Coding
New
ML System Design
Salary Negotiation
Interview Guides
Blog
System Design
Low Level Design
AI Coding
Behavioral
New
Interview Questions
Success Stories
System Design
Low-Level Design
New
Ask The Community
Discord
Mock Interviews
1:1 Mentorship
Refer a Friend
Pricing
Sign in / Sign up
Search
⌘K
Pricing

Tutor

Find Top 5 Largest Files in a Directory Tree

You are given two APIs: def list_dir(path: str) -> List[str]: """ Given a path, return the list of entries inside the directory. Return [] or raise an exception if the path is not a directory. """ pass def size_of(path: str) -> int: """ Given a file path, return its size in bytes. Raise an exception or return -1 if it's a directory. """ pass Implement the function: def get_top_5_largest_files(path: str) -> List[Tuple[int, str]]: """ Return a list of the top 5 largest files in the directory tree rooted at path. Each element is a tuple of (file_size, file_path). """ Constraints: You can assume there are no symbolic links (no cycles). Files and directories are represented as absolute paths (e.g., "/root/folder1/file.txt"). You must handle nested directories. You can assume there are no permission issues and paths are accessible.

Asked at:

Google

Google


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Company
​
Level
All Regions
Region

Late June, 2025

Google

Google

Junior

Your account is free and you can post anonymously if you choose.

Hello Interview Premium

Recent interview questions
System Design Guided Practice
Exclusive content
Learn More
Questions
Meta SWE Interview QuestionsAmazon SWE Interview QuestionsGoogle SWE Interview QuestionsOpenAI SWE Interview QuestionsEngineering Manager (EM) Interview Questions
Learn
Learn System DesignLearn DSALearn BehavioralLearn ML System DesignLearn Low Level DesignGuided Practice
Links
FAQPricingGift PremiumHello Interview Premium
Legal
Terms and ConditionsPrivacy PolicySecurity
Contact
About UsProduct Support

7511 Greenwood Ave North Unit #4238 Seattle WA 98103


© 2026 Optick Labs Inc. All rights reserved.