1 Star 0 Fork 0

catyMap / AlgorithmNote

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
longestDupSubstring.go 330 Bytes
一键复制 编辑 原始数据 按行查看 历史
dogemap 提交于 2022-01-22 21:52 . 更新题库
package main
import "sync/atomic"
func longestDupSubstring(s string) string {
n := len(s)
for l := n - 1; l > 0; l-- {
book := make(map[string]bool)
for i := 0; i+l < n; i++ {
str := s[i : i+l]
if book[str] {
return str
}
book[s] = true
}
}
atomic.CompareAndSwapUint32()
return ""
}
func main() {
}
Go
1
https://gitee.com/dogemap/algorithm-note.git
git@gitee.com:dogemap/algorithm-note.git
dogemap
algorithm-note
AlgorithmNote
dc486f96f6c1

搜索帮助