Kotlinlearncs.online LogoJava
Return to List

Solve: Binary String Is Balanced

Created By: Pranav Narayanan
/ Version: 2025.2.0

Write a method isBalanced that returns true if the passed String is balanced. A String is balanced if in every substring, the absolute difference between the number of 1s and 0s is at most 2. The passed value will only contain 1s and 0s.

Related Lessons

Stuck? You may find these lessons helpful:

Report a Problem

Attribution must link to this page: https://www.learncs.online/solve/kotlin/binary-string-is-balanced/[email protected]