Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,14 @@
|
|||
var lcs // recursive
|
||||
lcs = Fn.new { |x, y|
|
||||
if (x.count == 0 || y.count == 0) return ""
|
||||
var x1 = x[0...-1]
|
||||
var y1 = y[0...-1]
|
||||
if (x[-1] == y[-1]) return lcs.call(x1, y1) + x[-1]
|
||||
var x2 = lcs.call(x, y1)
|
||||
var y2 = lcs.call(x1, y)
|
||||
return (x2.count > y2.count) ? x2 : y2
|
||||
}
|
||||
|
||||
var x = "thisisatest"
|
||||
var y = "testing123testing"
|
||||
System.print(lcs.call(x, y))
|
||||
Loading…
Add table
Add a link
Reference in a new issue