mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-04 16:12:47 +08:00
16 lines
275 B
Go
16 lines
275 B
Go
package leetcode
|
|
|
|
func largeGroupPositions(S string) [][]int {
|
|
res, end := [][]int{}, 0
|
|
for end < len(S) {
|
|
start, str := end, S[end]
|
|
for end < len(S) && S[end] == str {
|
|
end++
|
|
}
|
|
if end-start >= 3 {
|
|
res = append(res, []int{start, end - 1})
|
|
}
|
|
}
|
|
return res
|
|
}
|