0 out of 464 challenges solved
Write a function `find_max_difference` that takes a binary string as input and returns the maximum difference between the number of `0`s and `1`s in any substring of the given string. If no such substring exists, return `0`. #### Example Usage ```python [main.nopy] find_max_difference("11000010001") # Output: 6 find_max_difference("10111") # Output: 1 find_max_difference("1111") # Output: 0 ``` #### Constraints - The input string will only contain characters `0` and `1`. - The length of the string will be between `1` and `10^5`.
def find_max_difference(binary_string): """ Calculate the maximum difference between the number of 0s and 1s in any substring. Args: binary_string (str): A string consisting of '0's and '1's. Returns: int: The maximum difference between the count of '0's and '1's in any substring. """ # Placeholder for the solution pass