Kotlinlearncs.online LogoJava
Return to List

Homework: xy Balance

Imported By: learncs.online Staff
/ Version: 2021.7.0
/ Adapted from CodingBat

We'll say that a String is xy-balanced if for all the 'x' characters there exists a 'y' character later in the string. So "xxy" is balanced, but "xyx" is not. One 'y' can balance multiple 'x's. Return true if the given String is xy-balanced.