FunctionRacerProblemsRace

Positions of Large Groups

EasyStringsPython, JavaScript, TypeScript, Java, C++

A group is a maximal run of the same character in s. A large group has 3 or more characters. Return a list of [start, end] index pairs (both inclusive) for every large group, in order from left to right. Return an empty list if there are none.

Example 1

s "abbxxxxzzy"
returns [[3,6]]

Only xxxx is large: [[3, 6]].

Example 2

s "abc"
returns []

No large groups.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Strings problems