Positions of Large Groups
You can find the intervals of large groups in the given string by iterating through the string and checking the length of consecutive characters. If the length is 3 or more, you can mark it as a large group.
Here’s the solution:
 Initialize a list to store the large groups’ intervals.
 Iterate through the string using a loop, keeping track of the start and end index of consecutive characters.
 When a new character is encountered, check if the current group’s length is 3 or more. If so, add the interval to the list.
 Continue this process until the end of the string.
Here’s the code:


This solution iterates through the string once, so the time complexity is O(n), where n is the length of the string. It returns the intervals of every large group sorted in increasing order by the start index.