I want to find the substring with the most
1's in a sequence of
Your program has two inputs, the sequence and the substring length.
The sequence is any number of
The substring length is any positive non-zero integer:
Your program should output the starting index of the first substring of the given length that contains the most
1's. With the above input, the output is:
The first character in the string starts at an index of
Shortest code wins!
- Your program must always output the correct index for any valid inputs.
- You can pick your input/output method from any answer with positive score on the default options. Please specify the method you pick in your answer.
1's, you output the first substring you found. You identify the substrings with the index of the first character in that substring. Does that help? \$\endgroup\$