[ INFO ]category: Coding difficulty: medium freq: high first seen: 2026-01-18
[MEDIUM][CODING][HIGH]TreeGraphDFSData Modeling
$catproblem.md
Given a hierarchical structure of Teams, Folders, and Files with user access permissions, find the minimum set of top-level items that grant a user access to all their permitted resources.
Background:
Each Team, Folder, and File has a list of user IDs who can access it
If a user can access a higher-level item, they inherit access to all children
Need to find the "roots" of the user's access tree
Challenge Notes:
The three classes (Team, Folder, File) are similar but separate
user_ids are lists, not sets (need to handle lookups)
init_function stores state but doesn't return anything
Build a unified tree structure from the disparate data
Requirements:
init_function(teams, folders, files) - Process and store the data
get_fewest(user_id) - Return minimum set of items for full access
Constraints:
UUIDs are unique strings
Users can have direct access at any level
A user may have redundant access (both direct and inherited)