Class Solution
-
- All Implemented Interfaces:
public final class Solution3295 - Report Spam Message.
Medium
You are given an array of strings
messageand an array of stringsbannedWords.An array of words is considered spam if there are at least two words in it that exactly match any word in
bannedWords.Return
trueif the arraymessageis spam, andfalseotherwise.Example 1:
Input: message = "hello","world","leetcode", bannedWords = "world","hello"
Output: true
Explanation:
The words
"hello"and"world"from themessagearray both appear in thebannedWordsarray.Example 2:
Input: message = "hello","programming","fun", bannedWords = "world","programming","leetcode"
Output: false
Explanation:
Only one word from the
messagearray ("programming") appears in thebannedWordsarray.Constraints:
<code>1 <= message.length, bannedWords.length <= 10<sup>5</sup></code>
1 <= message[i].length, bannedWords[i].length <= 15message[i]andbannedWords[i]consist only of lowercase English letters.
-
-
Constructor Summary
Constructors Constructor Description Solution()
-