"Longest Duplicate Substring" hard task No 1044 not accepted yet, slight speed boost

This commit is contained in:
2022-05-22 00:56:39 +03:00
parent 729f686164
commit 16d840cc45

View File

@@ -214,8 +214,9 @@ func LongestDupSubstringSmartforceMark3Goroutine(s string, from int, to int) str
return "" return ""
} }
indicesNext := []int{} indicesNext := make([]int, 0, len(s))
indicesAll := []int{} indicesAll := make([]int, 0, len(s))
indicesEmpty := make([]int, 0, len(s))
for j := 0; j < strLen; j++ { for j := 0; j < strLen; j++ {
indicesAll = append(indicesAll, j) indicesAll = append(indicesAll, j)
@@ -243,7 +244,7 @@ func LongestDupSubstringSmartforceMark3Goroutine(s string, from int, to int) str
} }
indicesCurrent = indicesNext indicesCurrent = indicesNext
indicesNext = []int{} indicesNext = indicesEmpty
} }
} }