Data update

This commit is contained in:
Ingy döt Net 2023-12-16 21:33:55 -08:00
parent 35bcdeebf8
commit 74c69a0df6
2427 changed files with 31826 additions and 3468 deletions

View file

@ -0,0 +1,17 @@
program longest_common_substring;
print(lcs("thisisatest", "testing123testing"));
proc lcs(s1, s2);
if #s1 < #s2 then [s1, s2] := [s2, s1]; end if;
loop for l in [#s2, #s2-1..1] do
loop for s in [1..#s2-l+1] do
if (substr := s2(s..s+l)) in s1 then
return substr;
end if;
end loop;
end loop;
return "";
end proc;
end program;