FastPrepDetect Blocked Chat Messages
Problems/Detect Blocked Chat Messages

Detect Blocked Chat Messages

WhatNot logoWhatNot● MediumFULLTIMENEW GRADPHONE SCREENONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A senior-engineer report describes chat filtering for profanity-like words, and another engineering report names detection in a message stream. Our version is about 70% the same as these descriptions. The vocabulary, whole-word matching, how letter case is handled, batch boundaries, and limits are our assumptions.

You are given an array of chat messages and a list of blockedWords. In message order, return true for each message that contains a blocked word and false for each that does not.

For this exercise:

  • A word is a complete group of consecutive English letters A-Z or a-z. Every other character separates words.
  • Ignore uppercase and lowercase differences when comparing words. Blocked words are supplied in lowercase.
  • A complete word must match; a blocked word inside a longer word does not count.
  • Messages are independent, and a word cannot span messages.
  • An empty message or an empty blocked-word list never produces a match. Repeated blocked words have no additional effect.

Function

detectBlockedMessages(messages: String[], blockedWords: String[]) → boolean[]

Examples

Example 1

messages = ["A SPOILER!","spoilers ahead","normal chat"]blockedWords = ["spoiler"]return = [true,false,false]

Matching ignores English letter case and requires the entire token: spoilers does not equal spoiler.

Example 2

messages = ["spam2offer","offer_spam",""]blockedWords = ["spam"]return = [true,true,false]

Digits and underscores separate tokens. An empty message contains no token.

Example 3

messages = ["hello","HELLO"]blockedWords = []return = [false,false]

An empty blocked-word list flags nothing.

Constraints

  • For this exercise, assume 0 <= messages.length, blockedWords.length <= 100.
  • Each message has at most 1000 printable ASCII characters.
  • Each blocked word has 1 to 20 lowercase English letters.

More WhatNot Phone Screen questions

  • Merge Sorted Squares of Two ArraysPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Adjacent Pair and Run RemovalPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • User Journey PathsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • User Journey Paths from a Log StreamPHONE SCREEN · Seen Nov 2026
  • Reachable Exits in an Obstacle GridPHONE SCREEN · Seen Oct 2026
  • Palindrome with One DeletionPHONE SCREEN · Seen Oct 2026
  • Search a 2D MatrixPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Attraction Route Without Reusing TrailsPHONE SCREEN · Seen Sep 2026
  • Earliest Car for Each PassengerPHONE SCREEN · Seen Sep 2026
  • Minimum Stores for a Shopping ListPHONE SCREEN · Seen Sep 2026

Similar questions at other companies

  • Classify Password StrengthHackerRank · OA · PHONE SCREEN · ONSITE INTERVIEWHackerRank interview questions
  • Highest Bid Campaign MatcherStackAdapt · ONSITE INTERVIEWStackAdapt interview questions
  • Route Pattern MatcherGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
  • Group AnagramsAmazon Web Services · ONSITE INTERVIEWAmazon Web Services interview questions
  • Linked Merchants Within Two HopsStripe · PHONE SCREENStripe interview questions
  • Query Log MatchDatadog · PHONE SCREEN · ONSITE INTERVIEWDatadog interview questions
  • Dasher Pay with Store Waits and Peak HoursDoorDash · PHONE SCREENDoorDash interview questions
  • File System Shell CommandsHarvey · ONSITE INTERVIEWHarvey interview questions
  • Fuzzy Word Lookup With One Misspelled LetterMeta · PHONE SCREENMeta interview questions
  • Most Frequent Call Path From Function Trace LogsRoblox · PHONE SCREEN · ONSITE INTERVIEWRoblox interview questions

Interview reports that mention this question

  • Whatnot interviews · November 2023
  • Whatnot interviews · June 2026
  • Whatnot interviews · July 2026
  • Whatnot interviews · December 2024
  • Whatnot interviews · November 2025
  • Whatnot interviews · March 2026 (Part 1 of 2)
All WhatNot interview questionsSee WhatNot hiring insights
Saved
class Solution {
    public boolean[] detectBlockedMessages(String[] messages, String[] blockedWords) {
        // write your code here
    }
}
Checking account…