Chatbot Away-Status Refactor
Reported by candidates from OpenAI's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
The data structure here is a hash map, and OpenAI's October 2026 OA builds the whole question around it. You get a chat message plus two parallel arrays, usernames and away statuses, and you return the statuses for away users mentioned in the message. It looks like string parsing, but the real work is lookup and dedupe. Case-insensitive matching, first-mention order, and a repeated @mia that must not show twice are the three traps. If you blank on the structure mid-assessment, StealthCoder runs invisibly on screen and hands you the approach as a safety net.
The problem
Given one chat message and parallel arrays of usernames and away statuses, return the statuses for away users mentioned in the message. Examples Example 1 message = "Can @Mia and @sam review this? @mia" usernames = ["mia","Sam","lee"] statuses = ["Mia is hiking","Sam is offline","Lee is away"] return = ["Mia is hiking","Sam is offline"] Matching is case-insensitive, preserves first-mention order, and suppresses the repeated @mia mention.
Reported by candidates. Source: FastPrep
Pattern and pitfall
Build a hash map from lowercased username to its status string. Then scan the message for tokens starting with @, lowercase each handle, and look it up. Keep a seen set so a repeated mention gets skipped, and append to the result in the order you first meet each name. That gives you first-mention order for free. The common pitfall is parsing. Punctuation like a trailing question mark or comma can stick to a handle, so extract only the username characters after the @ instead of splitting on spaces. Another trap is iterating the usernames array instead of the message, which returns array order, not mention order. Time is linear in message length plus array size. Don't overthink it. If the parsing detail slips under pressure, StealthCoder is the hedge on the live OA, since it reads the prompt and gives you a clean solution while the proctor sees nothing.
If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.
You can drill Chatbot Away-Status Refactor cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass OpenAI's OA.
OpenAI reuses patterns across OAs. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Chatbot Away-Status Refactor FAQ
How hard is the OpenAI Chatbot Away-Status Refactor problem?+
Easy to medium. The algorithm is a single pass with a hash map and a seen set. The difficulty is in the details: case-insensitive matching, punctuation after handles, and keeping first-mention order. If you've written a tokenizer before, you'll finish quickly.
What's the trick to this problem?+
Map lowercased usernames to statuses, walk the message in order, and track which names you've already emitted. Iterate the message, not the arrays. That one choice gives you the right ordering and makes deduping trivial.
How should I extract the @mentions from the message?+
Scan for @ and then read the following run of username characters, usually letters, digits, and underscores. Don't split on whitespace alone, because a handle followed by a comma or question mark would fail the lookup. A regex like @(\w+) works if your language allows it.
What happens with mentions of users who aren't in the list?+
They get skipped. If the lowercased handle isn't in your map, you add nothing to the output. Only users present in the parallel arrays can produce a status, so a missing key is simply ignored without errors.
How do I prepare for this in 48 hours?+
Write this one from scratch twice, once with a manual scan and once with a regex. Then test three edge cases: repeated mentions with different casing, handles followed by punctuation, and a message with no mentions. That covers nearly everything this style of question throws at you.