@@ -0,0 +1,24 @@
+func findSubstringInWraproundString(p string) (cnt int) {
+ n := len(p)
+ if n == 0 {
+ return
+ }
+ dp := make([]int, 256)
+ runes := []rune(p)
+ l := 1
+ dp[runes[0]] = 1
+ for i := 1; i < n; i++ {
+ if runes[i] != rune((runes[i-1]-'a'+1)%26+'a') {
+ l = 1
+ } else {
+ l++
+ if dp[runes[i]] < l {
+ dp[runes[i]] = l
+ for i := 'a'; i <= 'z'; i++ {
+ cnt += dp[i]
+}
@@ -0,0 +1,15 @@
+func rand10slow() int {
+ for {
+ if r49 := 7*(rand7()-1) + rand7(); r49 <= 40 {
+ return r49%10 + 1
+
+func rand10() int {
+ if r343 := 49*(rand7()-1) + 7*(rand7()-1) + rand7(); r343 <= 340 {
+ return r343%10 + 1