Consider the sequence 0100111100
There are 5 zeroes and 5 ones in this sequence.
The longest string of ones is 4.
The longest string of zeroes is 2.
The difference in string lengths is 2.
Create a sequence consisting of 100 zeroes and 100 ones which maximizes the difference in lengths between the longest string of 1's and the longest string of 0's.
Find a formula for the maximum difference in string lengths with n zeroes and n ones.
The solution seems to be
n 0's + k 1's + n 0's + 1 1 + n0's + 1 1 + ... + 1 1 + n 0's
where the last group with be short a few 0's
the number of 0 groups = ceil(100/n)
the number of single 1's = ceil(100/n) - 2
k = 102 - ceil(100/n)
Per excel, k - n is maximum of 82 when k = 10 and n = 92
A solution is
10 0's +
92 1's +
10 0's +
1 1 +
10 0's +
1 1 +
10 0's +
1 1 +
10 0's +
1 1 +
10 0's +
1 1 +
10 0's +
1 1 +
10 0's +
1 1 +
10 0's +
1 1 +
10 0's