Chatbot Away-Status Refactor
Updated
Problem statement
Given one chat message and parallel arrays of usernames and away statuses, return the statuses for away users mentioned in the message.
A mention is @ followed by one or more ASCII letters, digits, or underscores. Username matching is case-insensitive. Emit replies in first-mention order, and emit each matched user at most once. Ignore unknown mentions.
Function
awayReplies(message: String, usernames: String[], statuses: String[]) → String[]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.
Example 2
message = "Ask @unknown, then @lee_2"usernames = ["lee_2"]statuses = ["Back tomorrow"]return = ["Back tomorrow"]The unknown mention is ignored and the underscore is part of the second username.
Constraints
0 <= message.length <= 200000.1 <= usernames.length == statuses.length <= 20000.- Usernames are unique ignoring case and contain one to thirty ASCII letters, digits, or underscores.
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
- Business Account KYC Verification — Parts 1–5Stripe · PHONE SCREENStripe interview questions
- Most Frequent Call Path From Function Trace LogsRoblox · PHONE SCREEN · ONSITE INTERVIEWRoblox interview questions
- Video Cache Hit Rates from a CSV LogTubi · PHONE SCREEN
- Resolve Variable Equations with Dependency ErrorsApplied Intuition · PHONE SCREENApplied Intuition interview questions
- Query Log MatchDatadog · PHONE SCREEN · ONSITE INTERVIEWDatadog interview questions
- Chemical Formula WeightAgoda · PHONE SCREENAgoda interview questions
- Count Repeat Customers Across DatesAmazon · PHONE SCREEN
- Insert an Employee into an Organization HierarchyWaymo · PHONE SCREENWaymo interview questions
- JSON Identity VerificationKikoff · PHONE SCREENKikoff interview questions
- Parse Query StringAirbnb · PHONE SCREENAirbnb interview questions