Company: SCS Global Services
Difficulty: medium
3. Spam Detection Implement a prototype of an email spam detection algorithm. For simulation, subjects of n emails and k spam words are given in two arrays of strings, subjects and spam_words . An email is considered spam if it contains at least two spam words in the subject. If a spam word is repeated, it counts as two so the email is considered spam. The spam words are not case-sensitive. Given subjects and spam_words , return an array of n strings, \"spam\" or \"not_spam\", one for each subject. Input Format STRING_ARRAY subjects STRING_ARRAY spam_words Output Format Return a STRING_ARRAY containing \"spam\" or \"not_spam\" for each subject. Example 1 Suppose: subjects = [\"free prize worth millions\", \"ten tips for a carefree lifestyle\"] spam_words = [\"free\", \"money\", \"win\", \"millions\"] Subject Spam Words Answer free prize worth millions free, millions spam ten tips for a carefree lifestyle - not_spam Example 2 subjects = [\"Let it go\", \"The right thing to do\"] spam_wo