For instance, the data is as follows:
data = {1, 1, 1, -1, -1, 1, 1, -1}
The target output when determining how many times "1"
repeats should be:
{{1, 3}, {6, 2}}
with the 1
showing that the first set of repetitions begins at position 1
in the list and the 3
showing that "1"
occurs 3
times. The 6
shows that the second set of repetitions begins in the sixth position of the list and the "1"
occurs twice.