Dsa
Union Find
Medium
File System Groups
You are implementing a simplified file system with groups of users. Users can belong to multiple groups, and they have permissions associated with those groups. Given a list of commands to add users to groups or to check if two users have equivalent permissions, determine the outcome of each check.
Example:
Input:
5
add_group Alice Group1
add_group Bob Group2
check_permission Alice Bob
add_group Alice Group2
check_permission Alice Bob
Output:
NO
YES
Key concepts
union_findfile_systempermissions
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now