This commit is contained in:
苏尹岚
2021-01-07 16:17:16 +08:00
parent c99bb23e3d
commit fc595546ea
4 changed files with 38 additions and 8 deletions

View File

@@ -3,9 +3,7 @@ package jdshopapi
import (
"encoding/base64"
"fmt"
"math/rand"
"testing"
"time"
"git.rosy.net.cn/baseapi/utils"
)
@@ -114,5 +112,37 @@ func TestFindStoreInfoByExtStoreId(t *testing.T) {
}
func TestWIREHL(t *testing.T) {
fmt.Println(fmt.Sprintf("%06v", rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(1000000)))
fmt.Println(largeGroupPositions("abcdddeeeeaabbbcd"))
}
func largeGroupPositions(s string) (result [][]int) {
var (
l = 0
r = 1
count int
)
fmt.Println(len(s))
for {
fmt.Println(l, r, count)
if r == len(s) {
if count > 1 {
result = append(result, []int{l, r - 1})
count = 0
}
break
}
if s[l] != s[r] {
if count > 1 {
result = append(result, []int{l, r - 1})
count = 0
}
l = r
r++
count = 0
} else {
count++
r++
}
}
return result
}