Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,13 @@
|
|||
def lcs(xstr; ystr):
|
||||
if (xstr == "" or ystr == "") then ""
|
||||
else
|
||||
xstr[0:1] as $x
|
||||
| xstr[1:] as $xs
|
||||
| ystr[1:] as $ys
|
||||
| if ($x == ystr[0:1]) then ($x + lcs($xs; $ys))
|
||||
else
|
||||
lcs(xstr; $ys) as $one
|
||||
| lcs($xs; ystr) as $two
|
||||
| if ($one|length) > ($two|length) then $one else $two end
|
||||
end
|
||||
end;
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
lcs("1234"; "1224533324"),
|
||||
lcs("thisisatest"; "testing123testing")
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# jq -n -f lcs-recursive.jq
|
||||
"1234"
|
||||
"tsitest"
|
||||
Loading…
Add table
Add a link
Reference in a new issue