The question evaluates a software engineer's ability to design lightweight in-memory APIs and data structures for bidirectional user sessions, covering API design, hash-based adjacency structures, complexity analysis, concurrency control, edge-case handling, and basic testing.
Design a lightweight, in-memory manager that tracks bidirectional user-to-user sessions (think direct-message sessions). Provide 2–3 API functions:
Assume user IDs are strings (or integers) and all data lives in a single process. No persistence is required.
Login required