Skip to content

Practice Report Spam Message

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#3295
LeetCode Problem

Report Spam Message

Problem Statement

You are given an array of strings message and an array of strings bannedWords. An array of words is considered spam if there are at least two words in it that exactly match any word in bannedWords. Return true if the array message is spam, and false otherwise.

Source: Report Spam Message on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
message = ["hello","world","leetcode"], bannedWords = ["world","hello"]
Output
true

# Example 2

Input
message = ["hello","programming","fun"], bannedWords = ["world","programming","leetcode"]
Output
false

Constraints

1 <= message.length, bannedWords.length <= 10^5
1 <= message[i].length, bannedWords[i].length <= 15
message[i] and bannedWords[i] consist only of lowercase English letters.

Related LeetCode Problems

Practice more problems similar to Report Spam Message.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.