Problem · String

Count Triple

Learn this problem
EasyZipRecruiter logoZipRecruiterINTERNOA

Problem statement

Checkout the image source below for the original problem statement :P

Once upon a time, in the land of letters and words, there was a string called "sentence." This string was filled with words, and hidden among them were special words that contained a secret: within each of these words, one letter appeared at least three times. These magical "triple-letter" words held a unique charm, but they were hard to spot because the letters could be in any form, whether uppercase or lowercase. Your quest is to wander through the sentence and find all of these enchanted words, where the same letter appears at least three times, no matter its case. A word in this sentence is a sequence of English letters surrounded by white spaces, marking the boundaries of each word. You don’t need to rush to find the most efficient solution. As long as your method can explore each word carefully—checking the length of the sentence and the longest word within—it will be more than enough to solve the riddle within the limits of time. Go forth, and count all the special words hidden in the sentence!

Function

countTriple(sentence: String) → int

Examples

Example 1

sentence = "Dooddle moodle Pepper unsuccessfully"return = 3

Dooddle qualifies because d appears three times when case is ignored. Pepper qualifies because p appears three times. unsuccessfully also qualifies because both u and s appear at least three times. The word moodle does not qualify.

Constraints

Unknwon for now

More ZipRecruiter problems

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