Spam word repetition
A chat spam filter flags messages that are just one word repeated over and over. Given a message of words separated by single spaces (possibly empty), return True if the message consists of the same word repeated three or more times when compared case-insensitively, and False otherwise. For example, 'buy BUY buy' is spam, but 'buy buy' (only twice) and 'hello hello hello world' are not.
Implement
is_word_spam(message: str) → boolExamples
in
["buy BUY buy"]outtrueWhat a strong answer looks like
State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
0:00 of about 10 min
solution.py
InputExpectedGot
["buy BUY buy"]truenot run yetsample