result
to store the intervals of large groups.i
and j
to 0.j
as the index.
a. If j
reaches the end of the string or the character at j
is not equal to the character at j + 1
, check if the group is large.
b. If the group is large (i.e., j - i + 1 >= 3
), append the interval [i, j]
to result
.
c. Update i
to j + 1
to start the next group.result
list.