Pergunta de entrevista da empresa Vanguard

One thing they asked you during the technical assessment was to implement an email spam detection algorithm. The task involved checking if the subject of an email contained at least two spam words from a given list, ensuring the solution accounted for case-insensitive matches and word repetition.

Resposta da entrevista

Sigiloso

16 de out. de 2024

I answered the question by implementing the email spam detection algorithm in C++ as follows: Normalize Case: You converted all spam words and email subjects to lowercase to ensure case-insensitive matching. Efficient Lookup: You stored the spam words in an unordered set to allow for quick lookups. Word Counting: For each email subject, you split the string into individual words and checked how many of those words matched the spam words from the list. Spam Detection: If two or more spam words were found in the subject, you marked the email as "spam"; otherwise, it was marked as "not_spam." The solution was efficient and handled the constraints well, ensuring fast performance even with large inputs.