[ INFO ]category: Behavioral · Onsite difficulty: medium freq: first seen: 2024-05-13
[MEDIUM][ONSITE]OnsiteSDE IIRejected
$catproblem.md
Interview Rounds:
The interview comprised three to four rounds conducted on the same day. The timings for the first two rounds were provided, with subsequent rounds scheduled based on the initial feedback.
Round 1:
The first question involved a basic tree serialization problem, requiring a breadth-first search traversal to print nodes in traversal order. I solved this easily.
The second question focused on identifying substrings within a given string. I discussed various algorithms such as Aho-Corasick, Rolling Hash (Rabin-Karp), and Knuth-Morris-Pratt (KMP), explaining their suitability for different scenarios. The interviewer appeared satisfied with my response.
Round 2:
This round was a low-level design (LLD) interview.
The problem involved designing a directory permissioning system allowing users to check, grant, and revoke permissions. Three APIs were required:
checkAccess(UserId, DirectoryPath): Checks if a user has access to a directory path.
grantAccess(UserId, DirectoryPath): Grants access to a user for a given directory path, extending access to all subdirectories.
revokeAccess(UserId, DirectoryPath): Revokes user access from a directory and its subdirectories.
If a user has permissions to a directory, all subdirectories should also grant access unless revoked specifically. Example:
grantAccess(U1, '/a/b/')
checkAccess(U1, '/a/b/c') -> True
revokeAccess(U1, '/a/b/d')
checkAccess(U1, '/a/b/d/e') -> False
checkAccess(U1, '/a/b/f/g') -> True
I proposed a Trie structure (an in-memory solution I believe is suboptimal) but struggled with a clear explanation.
The system only handles directories, not files, and no file system is provided to verify directory existence.
I considered persistent storage options (relational, graph, document databases), but each had limitations in efficiently handling all operations.
I did not receive invitations for further rounds, indicating a rejection.