Problem Β· String

Narrative Words πŸ₯

Learn this problem
● EasyTDTrade DeskOA

Problem statement

Given a sentence words, count how many words contain at least one English letter that appears three or more times anywhere in that word. The repeated occurrences do not need to be consecutive.

Words consist of English letters and are separated by whitespace. Count letters case-insensitively.

Return the number of qualifying words.

Function

narrativeWords(words: String) β†’ int

Examples

Example 1

words = "Dooddle moodle Pepper unsuccessfully"return = 3

Dooddle has three occurrences of d, Pepper has three occurrences of p, and unsuccessfully has a letter occurring at least three times. moodle does not qualify.

Constraints

Unknown for now

More Trade Desk problems

drafts saved locally
public int narrativeWords(String words) {
  // write your code here
}
words"Dooddle moodle Pepper unsuccessfully"
expected3
checking account