id/email
password
forgot password
about | help | done | prefs | create account
CodingBat code practice

Java > String-3 > countTriple
prev  |  next  |  chance

We'll say that a "triple" in a string is a char appearing three times in a row. Return the number of triples in the given string. The triples may overlap.

countTriple("abcXXXabc") → 1
countTriple("xxxabyyyycd") → 3
countTriple("a") → 0

...Save, Compile, Run

See also Java Example Code. Java help docs: If Boolean Logic | Strings | While and For Loops | Arrays and Loops


prev  |  next  |  chance   |  CodingBat  >  String-3

Forget It! -- delete my code for this problem 315.0

Copyright Nick Parlante 2006-10 - privacy