Explore Problems Contest Discuss Interview Store Dynamic Layout 0 avatar Premium 100400.…
- User
Explore Problems Contest Discuss Interview Store
Dynamic Layout 0
avatar Premium 100400. Report Spam Message User Accepted:1008 User Tried:1351 Total Accepted:1013 Total Submissions:1409 Difficulty:Medium 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.
Example 1:
Input: message = ["hello","world","leetcode"], bannedWords = ["world","hello"]
Output: true
Explanation:
The words "hello" and "world" from the message array both appear in the bannedWords 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 the bannedWords array.
Constraints:
1 <= message.length, bannedWords.length <= 105 1 <= message[i].length, bannedWords[i].length <= 15 message[i] and bannedWords[i] consist only of lowercase English letters. C++ 1 class Solution { 2 public: 3 bool reportSpam(vector& message, vector& bannedWords) { 4
5 } 6 }; Custom Testcase Copyright © 2024 LeetCode Help Center Jobs Bug Bounty Online Interview Students Terms Privacy Policy United StatesUnited States
- Assistant