"Longest Duplicate Substring" hard task No 1044 not accepted bruteforce solution

This commit is contained in:
2022-04-20 20:28:18 +03:00
parent 9ebb71d76f
commit f4a90a3f21
2 changed files with 75 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
package main
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestLongestDupSubstring(t *testing.T) {
assert.Equal(t, "ana", LongestDupSubstring("banana"))
assert.Equal(t, "", LongestDupSubstring("abcd"))
assert.Equal(t, "aaa", LongestDupSubstring("aaaa"))
assert.Equal(t, "", LongestDupSubstring(""))
assert.Equal(t, "", LongestDupSubstring("a"))
assert.Equal(t, "x", LongestDupSubstring("xx"))
assert.Equal(t, "xx", LongestDupSubstring("xxx"))
assert.Equal(t, "bananab", LongestDupSubstring("bananabananab"))
assert.Equal(t, "sfd", LongestDupSubstring("polxtvqlurgobbzbjcjsupskvzmtuveuavrzcxaifmdwqjbuejdasuxcvsupqnucorfawncjqkbakilhiekavhmsjbtlsfydijafxhgrgbsswtnvdquwokcliaxevairergwdtndsibiulqiutkcwsqpzuyypnhiowgvkkdbpkoyvgwyuqcokjnxluamwnuhqjtaossezwxvkpdkqcleqjkelcludtbigxkueupnxjncrbgvdrsdpppqqcopnwadqsxkvlkghfmtvdeygpyxamvxhmmaunxskgnenobvnzizbxwrjeedisrgzykoaidiffzqzsmirxkvfwmtifywamcpxziyjohcudzelgbmdgiaqwnzdbkwbhdioiokaivzlzscshrvbmggdztjuimribrgmdlcctvldbcxwpqnqbkzrcayqdqraobqcgoxxocclasphcjcydpkgkqhrmmxtklpxfxnrgnzczjxanaltnjhwfatgryqhcllemgqcchiagizpdgiqioqyhrpattutmuotrcwtxvdqzzsomofizebbqrgwruydyawsssjkakjpjlzmfhmjetymftxrhilpcgfqyoohyydnodfortlkeoncmfkdraiqydxcodyapjaxumjwczwmthrcecfgsswwtnyqurvggamjbsjdzmcuyefwnsrnhhpusfdsxbsrsrywbccullupdbovnmzluqsfdhqbef"))
}