"Longest Duplicate Substring" hard task No 1044 not accepted yet, slight speed boost
This commit is contained in:
@@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user