Chatter Message Window
Reported by candidates from Reddit's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
Reddit's Chatter Message Window showed up in candidate reports from July 2026, and the mistake that sinks a first attempt is treating the IDs as strings or floats. They're decimals like "1.10" and "2.25", loaded in increasing order across batches. It's a design-style simulation: one ordered store, six operations, and every non-LOAD op returns a result. Nothing here is algorithmically deep. The risk is sloppy bookkeeping under pressure. If you've got the OA in a day or two, learn the shape of the state now. If you blank on the live assessment, StealthCoder is the safety net running invisibly on your screen.
The problem
Process an ordered sequence of operations on messages with unique decimal IDs. Messages are loaded in strictly increasing numeric ID order across all batches. ["LOAD", id1, text1, id2, text2,...] appends a non-empty ordered batch and produces no result. ["SAVE"] returns all current messages in ID order as [id1, text1, id2, text2,...]. ["GET_MESSAGES", id] returns the identified message, up to two preceding messages, and up to two following messages in the same flattened form. A missing ID returns an empty list. ["GET_MULTI", id1, id2,...] unions the windows for all existing requested IDs, removes duplicate messages, and returns them in numeric ID order. ["EDIT", id, newText] replaces the current text and returns ["true"], or returns ["false"] for a missing ID. ["GET_HISTORY", id] returns the initially loaded text followed by every successful edit text in chronological order, or an empty list for a missing ID. Return the result of every non-LOAD operation in operation order. Repeated read queries do not change state. Function processChatter(operations: String[][]) → String[][] Examples Example 1 operations = [["LOAD","1","one","2","two","3","three","4","four","5","five"],["GET_MESSAGES","3"],["GET_MESSAGES","1"],["GET_MULTI","2","5"],["SAVE"]] return = [["1","one","2","two","3","three","4","four","5","five"],["1","one","2","two","3","three"],["1","one","2","two","3","three","4","four","5","five"],["1","one","2","two","3","three","4","four","5","five"]] The window centered at 3 reaches both boundaries. The windows for 2 and 5 overlap, so their union contains each message once. Example 2 operations = [["LOAD","1.10","a","2.25","b","4","c"],["LOAD","5","d","9","e"],["GET_MESSAGES","4"],["EDIT","4","C2"],["GET_MESSAGES","4"],["GET_HISTORY","4"],["SAVE"]] return = [["1.10","a","2.25","b","4","c","5","d","9","e"],["true"],["1.10","a","2.25","b","4","C2","5","d","9","e"],["c","C2"],["1.10","a","2.25","b","4","C2","5","d","9","e"]] Editing changes the current message used by reads and save, while history retains both the loaded and edited text. Example 3 operations = [["LOAD","10","a","20","b","30","c"],["GET_MESSAGES","99"],["EDIT","99","missing"],["GET_HISTORY","99"],["EDIT","20","B"],["EDIT","20","B2"],["GET_HISTORY","20"],["GET_MULTI","10","10","99"]] return = [[],["false"],[],["true"],["true"],["b","B","B2"],["10","a","20","B2","30","c"]] Missing IDs have total deterministic results. Repeating 10 in GET_MULTI does not duplicate its three-message boundary window. Constraints 1 <= operations.length <= 10^4. Across all loads there are at most 10^5 messages, and across all multi-queries there are at most 10^5 requested IDs. Message IDs are canonical finite decimal strings with at most two fractional digits, fit after scaling by 100 in a signed 64-bit integer, are unique, and arrive in strictly increasing numeric order. Message text contains printable ASCII characters and has length at most 200. Every operation has a supported opcode and the exact arity described above.
Reported by candidates. Source: FastPrep
Pattern and pitfall
Parse each ID into a scaled integer (multiply by 100) so "1.10" becomes 110 and comparisons are exact. Since loads arrive in strictly increasing order, keep an array of messages plus a hash map from scaled ID to index. Never re-sort. GET_MESSAGES is index-based: take max(0, i-2) through min(n-1, i+2). GET_MULTI is the trap. Collect the index ranges for every existing ID, then merge them into a boolean mark array or interval merge, and output in index order. Repeated IDs must not duplicate output. Keep a per-message history list seeded with the loaded text and appended on each successful EDIT. Missing IDs return an empty list, and EDIT on a missing ID returns ["false"]. Flatten output as id, text pairs, using the original ID string. With 10^5 messages and 10^5 queried IDs, the merge approach stays linear. StealthCoder is the hedge if the flattening or union logic slips live.
StealthCoder is the hedge for the one pattern you didn't drill. It runs invisibly during the screen share.
You can drill Chatter Message Window 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. If you're reading this with an OA window open, you're who this was built for.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Reddit's OA.
Reddit reuses patterns across OAs. If you're reading this with an OA window open, you're who this was built for. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Chatter Message Window FAQ
How hard is the Reddit Chatter Message Window problem really?+
Easy to medium in logic, but fiddly in details. There's no clever algorithm. You need an ordered array, an ID-to-index map, and per-message history. Most failures come from decimal ID handling and duplicate windows in GET_MULTI, not from complexity.
What's the trick for GET_MULTI?+
Convert each existing ID to its index, expand to a range of index-2 to index+2 clamped to bounds, and mark those indices. Then walk the array once and emit marked messages. That removes duplicates and keeps numeric ID order for free, since the array is already sorted.
Why can't I just store IDs as floats?+
IDs have up to two fractional digits and must match exactly. Floats can misrepresent values like 1.10 and break lookups. Parse the string into an integer scaled by 100, or key the map by the original canonical string. Use the scaled integer if you need comparisons.
How should edits and history interact?+
History starts with the loaded text. Each successful EDIT updates the current text and appends the new text to history. A missing ID returns ["false"] and changes nothing. GET_HISTORY returns the full list in chronological order, or an empty list when the ID doesn't exist.
How do I prepare for this in 48 hours?+
Write the class once from scratch and run the three examples by hand. Test edge cases: a window at the start or end, a missing ID, repeated IDs in GET_MULTI, and a second LOAD batch. Check that reads never mutate state. That covers nearly everything the tests will hit.