Company: IBM application developer - cloud full stack_16march
Difficulty: medium
Question 1 You are given: texts[n] : an array of text strings to classify spamWords[k] : an array of words considered spam indicators Classify each text as "spam" or "not_spam" using these rules: A text is "spam" if it contains at least 2 occurrences of words that appear in spamWords . A text is "not_spam" if it contains fewer than 2 such occurrences. Matching is case-insensitive. Words are separated by single spaces (treat each token as a word). Each occurrence counts, including repeated spam words in the same text (for example, "paid paid" counts as 2). Only consider words that exactly match a spam word (no partial matches). Return an array of length n , where the i th value is the label for texts[i] . Example 1 texts = ["free prize worth millions", "ten tips for a carefree lifestyle"] spamWords = ["free", "money", "win", "millions"] Text Spam Words Found Answer free prize worth millions free, millions spam ten tips for a carefree lifestyle - not_spam Return ["spam", "not_spam"] . Ex