InterviewDB Question

Resource Access Log: Audit Who Accessed What Resource and When

Question Details

Problem You are given a list of access log entries: {user_id, resource_id, action, timestamp} where action is "read" or "write". Answer two queries: most_accessed(resource_id): return the user_id who accessed the resource the most times total. unauthorized_writes(allowed_writers: set): return a sorted list of user_ids who performed write actions but are NOT in the allowed_writers set. Example: Follow-ups How would you build the data structures in init to make both queries O(1) or O(k) in the res…

Full Details

🔒

Unlock all Karat questions

Full insider details, leaked discussions, and candidate experiences.

or every company, $100/year →

About This Question

This is a reported interview question from a karat interview.

It covers the following topics: Coding .

Topics