Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,25 @@
|
|||
# Project : Longest Common Substring
|
||||
|
||||
str1 = "testing123testing"
|
||||
str2 = "tsitest"
|
||||
see longest(str1, str2)
|
||||
|
||||
func longest(str1, str2)
|
||||
subarr = []
|
||||
for n=1 to len(str1)
|
||||
for m=1 to len(str1)
|
||||
sub = substr(str1, n, m)
|
||||
if substr(str2, sub) > 0
|
||||
add(subarr, sub)
|
||||
ok
|
||||
next
|
||||
next
|
||||
|
||||
temp = 0
|
||||
for n=1 to len(subarr)
|
||||
if len(subarr[n]) > temp
|
||||
temp = len(subarr[n])
|
||||
subend = subarr[n]
|
||||
ok
|
||||
next
|
||||
see subend + nl
|
||||
Loading…
Add table
Add a link
Reference in a new issue