Back to problems

Spam Classification

Algorithm · Salesforce · Easy

You are given an array of strings texts and an array of strings spamWords. For each element in texts, classify it as "spam" if the text contains at least two words that appear in spamWords. Otherwise, classify it as "not_spam". The matching should be case-insensitive, meaning that differences in capitalisation between the text and the spam-words list do not affect the match. If the same spam word appears multiple times inside a single text, each occurrence counts towards the…

Checking your access…