You are given a binary string str of length n. Suppose you create another string of size n * k by concatenating k copies of str together. What is the maximum size of a substring of the concatenated string consisting only of 0’s? Given that k > 1.
Input : str = “110010”, k = 2
Output : 2
String becomes 110010110010 after two concatenations. This string has two zeroes.
Input : str = “00100110”, k = 4
Output : 3
If given string contains all zeroes then the answer is n * k. If S contains ones then the answer is either the maximum length of a substring of str containing only zeroes, or the sum between the length of the maximal prefix of S containing only zeroes and the length of the maximal suffix of str containing only zeroes. The last one must be computed only if k > 1.
- Maximum length of consecutive 1's in a binary string in Python using Map function
- Maximum consecutive one’s (or zeros) in a binary array
- Maximum consecutive one’s (or zeros) in a binary circular array
- Check if a binary string contains consecutive same or not
- Maximum consecutive repeating character in string
- Check if a binary string has two consecutive occurrences of one everywhere
- Length of longest consecutive ones by at most one swap in a Binary String
- Nth character in Concatenated Decimal String
- Concatenated string with uncommon characters of two strings
- Concatenated string with uncommon characters in Python
- Print Kth character in sorted concatenated substrings of a string
- Print the final string when minimum value strings get concatenated in every operation
- Maximum contiguous 1 possible in a binary string after k rotations
- Maximum difference of zeros and ones in binary string
- Arrange a binary string to get maximum value within a range of indices
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : ihritik