X247: gHappy

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.

Examples:

gHappy("xxggxx") -> true
gHappy("xxgxx") -> false
gHappy("xxggyygxx") -> false
Reset

Practice a different Java exercise