44.2k views
0 votes
Widest Fragment in a Sequence Write a program to read a sequence of integer numbers ending with the number 0. Determine the length of the widest fragment (consecutive sub-sequence) where all the elements are equal to each other.

User Bramble
by
7.6k points

1 Answer

0 votes

Final answer:

The question is about writing a program to find the longest sub-sequence of consecutive identical numbers in a sequence that ends with a 0.

Step-by-step explanation:

The question asks for a program that analyses a sequence of integers to find the length of the longest consecutive sub-sequence of equal numbers, ending when a 0 is encountered. This programming challenge can be approached by iterating through the sequence, tracking the current number, the length of the current fragment, as well as the length of the widest fragment so far. When a new number is different from the current number, the fragment length is reset. By the end of the sequence, the program should have determined the length of the widest fragment.

User Venatu
by
8.2k points