Positions of Large Groups Problem

Positions of Large Groups Problem — ExecCode Easy DSA Practice

Solve the Positions of Large Groups problem on ExecCode. Free online easy DSA practice in String. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Description You are given the input needed to solve Positions of Large Groups. Your task is to compute the required answer and return the intervals of every large group sorted in increasing order by start index . In a string s of lowercase letters, these letters form consecutive groups of the same character. For example, a string like s = "abbxxxxzyy" has the groups "a", "bb", "xxxx", "z", and "yy". A group is identified by an interval [start, end], where start and end denote the start and end indices (inclusive) of the group. In the above example, "xxxx" has the interval [3,6].

Examples

Input {"s": "abbxxxxzzy"}; Output [[3, 6]]. Input {"s": "abc"}; Output []

Constraints

1 <= s.length <= 1000 s contains lowercase English letters only.

Practice Positions of Large Groups free on ExecCode. Browse DSA problems, topic map, and placement guides.