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

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

We'll say that a lowercase 'g' in a string is "happy" if there is another 'g' immediately to its left or right. Return true if all the g's in the given string are happy.

gHappy("xxggxx") → true
gHappy("xxgxx") → false
gHappy("xxggyygxx") → false

...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 312.0

Copyright Nick Parlante 2006-10 - privacy