# LeetCode 830. Positions of Large Group

Created at 2018-07-10 Updated at 2018-07-10 Category LeetCode Tag LeetCode

## Question

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".
Call a group large if it has 3 or more characters. We would like the starting and ending positions of every large group.
The final answer should be in lexicographic order.

Example 1

Example 2

Example 3

Note: 1 <= S.length <= 1000

## Solution

Using two pointers, l and r, if current nums[l]==nums[r], increase r and check if r reach the end.

Python code

C++ code

## Table of Content

Site by GoingMyWay using Hexo & Random

I am a ML and RL research student

Hide