FastPrepMachine Message Router
Problems/Machine Message Router

Machine Message Router

OpenAI logoOpenAI● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an OpenAI phone screen for a full-time role. The original report names a three-part task about sending customizable string messages to machines. It does not keep the machine lifecycle, the delivery result, the read behavior, how commands are written, or the limits. Here you get a finite sequence of operations with the usual rules and a fixed outcome.

Process an ordered sequence of operations for an in-memory machine message router. Each operation is one of:

  • REGISTER|machineId: register the machine. Registering an existing machine is a no-op and produces no output.
  • SEND|machineId|message: if the machine is registered, append the complete message to its unread inbox and output true. Otherwise, output false and discard the message.
  • READ|machineId: output all unread messages for that machine in send order, joined by semicolons, then clear its inbox. For an unregistered machine or an empty inbox, output an empty string.

Machine IDs are case-sensitive. Messages are customizable strings: they may contain spaces and punctuation other than pipes or semicolons. Return outputs only for SEND and READ operations, in operation order.

Function

processMachineMessages(operations: String[]) → String[]

Examples

Example 1

operations = ["REGISTER|alpha","SEND|alpha|hello world","SEND|beta|lost","READ|alpha","READ|alpha"]return = ["true","false","hello world",""]

The first message is delivered to the registered machine. The send to beta fails. Reading alpha returns and clears its inbox, so the next read is empty.

Example 2

operations = ["REGISTER|m1","REGISTER|m1","SEND|m1|build #42 ready!","SEND|m1|deploy at 09:30","READ|m1","SEND|m1|done","READ|m1"]return = ["true","true","build #42 ready!;deploy at 09:30","true","done"]

Repeated registration preserves the inbox. Custom punctuation and spaces remain unchanged, and each read returns only messages sent since the previous read.

Constraints

  • 0 <= operations.length <= 200000.
  • Every operation has exactly the syntax shown above.
  • 1 <= machineId.length <= 40, using English letters, digits, underscores, or hyphens.
  • 1 <= message.length <= 200, using printable ASCII other than | and ;.
  • The total length of all operation strings is at most 2000000.

More OpenAI Phone Screen questions

  • Secret Number Search with One-Call-Delayed FeedbackPHONE SCREEN · Seen Nov 2026
  • Determine the Winner of Three-Card HandsPHONE SCREEN · Seen Nov 2026
  • Grid Infection with Recovery After D DaysPHONE SCREEN · Seen Nov 2026
  • Sparse Plant Infection SimulationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Light Source Hits: Sample, Compare, and FitPHONE SCREEN · Seen Nov 2026
  • Rectangle Point Coverage CountsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Adaptive Calibration ErrorPHONE SCREEN · Seen Nov 2026
  • Elevator Scheduling SimulationPHONE SCREEN · Seen Nov 2026
  • Evaluate Noisy AnnotatorsPHONE SCREEN · Seen Oct 2026
  • Network Endpoint or Cycle BoundaryOA · PHONE SCREEN · Seen Oct 2026

Similar questions at other companies

  • Incident MonitorStripe · OAStripe interview questions
  • Query Log MatchDatadog · PHONE SCREEN · ONSITE INTERVIEWDatadog interview questions
  • Stateful Paginated Fetch NLyft · PHONE SCREENLyft interview questions
  • In-Memory Filesystem CommandsPerplexity AI · PHONE SCREEN · ONSITE INTERVIEWPerplexity AI interview questions
  • Constant-Time Weighted Pick with an Alias TableEtched · PHONE SCREEN
  • File Storage ServiceCresta · PHONE SCREENCresta interview questions
  • Return Every Matching DecryptionDuolingo · PHONE SCREENDuolingo interview questions
  • Implement a FIFO QueueByteDance · PHONE SCREENByteDance interview questions
  • Escape Room LeaderboardPinterest · PHONE SCREEN · ONSITE INTERVIEWPinterest interview questions
  • Numeric Poker OperationsRippling · PHONE SCREENRippling interview questions

OpenAI interview experiences

  • OpenAI OA: What It Tests (2026)
All OpenAI interview questionsSee OpenAI hiring insights
Saved
class Solution {
    public String[] processMachineMessages(String[] operations) {
        // write your code here
    }
}
Checking account…