[ OK ] 486 — full content available
[ INFO ] category: Coding difficulty: medium freq: high first seen: 2026-01-13
[MEDIUM][CODING][HIGH]Socket ProgrammingAsyncConcurrencyNetworking
$ cat problem.md
Design and implement a chat server that supports multiple clients using socket programming.
This is Discord's signature question - appears in almost every phone screen!
Interview Format:
- 75 minutes, share screen
- Use your own IDE (not LeetCode style)
- AI assistance may be opt-in (ask recruiter)
- Install
netcat and telnet beforehand for testing
Part 1 - Basic Chat Room:
- Allow multiple clients to connect
- Handle disconnections cleanly
- Server receives messages and broadcasts to all clients
Part 2 - Username Support:
- Clients create username on connection
- Display online users when joining
- Notify others when user leaves
Part 3 - Session Timeout:
- Implement timeout for inactive sessions
- Clean up resources on timeout
Part 4 - Production Discussion:
- What changes needed for production?
- How to scale to millions of users?
- Database and infrastructure choices
Key Technologies:
- Python:
asyncio, socket
- Can also use Go, Java, Node.js
Constraints:
- Must handle concurrent connections
- Clean resource management on disconnect
- Thread-safe or async implementation