Kotlinlearncs.online LogoJava
Return to List

Homework: xy Balance

Imported By: Geoffrey Challen
/ Version: 2021.7.0

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.

Related Lessons

Stuck? You may find these lessons helpful: