Class Solution
-
- All Implemented Interfaces:
public final class Solution
3295 - Report Spam Message\.
Medium
You are given an array of strings
message
and 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
true
if the arraymessage
is spam, andfalse
otherwise.Example 1:
Input: message = "hello","world","leetcode", bannedWords = "world","hello"
Output: true
Explanation:
The words
"hello"
and"world"
from themessage
array both appear in thebannedWords
array.Example 2:
Input: message = "hello","programming","fun", bannedWords = "world","programming","leetcode"
Output: false
Explanation:
Only one word from the
message
array ("programming"
) appears in thebannedWords
array.Constraints:
<code>1 <= message.length, bannedWords.length <= 10<sup>5</sup></code>
1 <= message[i].length, bannedWords[i].length <= 15
message[i]
andbannedWords[i]
consist only of lowercase English letters.
-
-
Constructor Summary
Constructors Constructor Description Solution()
-