Level: Senior-Level
Round: Onsite · Type: Coding · Difficulty: 8/10 · Duration: 180 min · Interviewer: Unfriendly
Topics: Hashmaps, System Design
Location: San Francisco, CA
Interview date: 2026-01-03
Question: Calculate the total active hours of each Twitter space, given operation records.
Question: Generate top-k spaces with the largest number of users in real time.
Question: Design the backend system for a checkers chess game.
The first coding question was:
Given following records (operation, twitter_space, user, timestamp), return the total active hours of each twitter space.
Input: ["create", "abc", "user_1", "1234567000] ["join", "abc", "user_2", "1234567100] ["leave", "abc", "user_2", "1234567300] ["create", "def", "user_2", "1234568000] ["leave", "def", "user_2", "1234568500] ["leave", "abc", "user_1", "1234569000] Output: {"abc": 2200, "def": 500}
Explanation: user1 在abc一共呆了2000, user2在abc一共呆了200, user2在def一共待了500
For this, I used a hashmap to record each user's entry and exit records for each room, and then iterated through each space's map to sum it up.
The follow-up was to generate top-k spaces with the largest number of users (in real time).
The second question was to design the backend system for a "checkers" chess game.
This was an open-ended question, and the given time was not enough to finish writing. I only wrote the initialization, the piece movement function, and the victory condition check. I didn't have time to write the eating action. The manager asked a follow-up question: "Which part of the code can be optimized further?"