Bit sequence | Sololearn: Learn to code for FREE!


Bit sequence

Hello everyone. I start by saying that I don't want to solve any task but at least understand the reasoning to find a solution algorithm. Practically I was given a problem that says that given a sequence of 11 bits such as 00001111111, I have to check which sub-sequence (if the one formed by 0 or 1) is the one with the most bits. Thanks in advance and sorry for the english.

3/24/2020 8:56:48 PM


6 Answers

New Answer


Hi, my only idea would be the subsequence with most equal bits. That would be 1111111.


In short you have to find the continuous sequence of 0 or 1 having the biggest length e.g. 000111 - both 0 and 1 have same length 3 0001110000111 - 0 has the biggest sequence of length 4 11000011111 - 1 has a biggest continuous sequence of length 5


what does the sub-sequence mean and what should I print in practice?


Oma Falk so if for example I enter 10001111101 and then 11111100000 I have to check for example in the first code what was the most present number of bits


~ swim ~ ok then i think i understand, thank you all.