RosettaCodeData/Task/Longest-common-subsequence/Zkl/longest-common-subsequence.zkl

6 lines
187 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
fcn lcs(a,b){
if(not a or not b) return("");
if (a[0]==b[0]) return(a[0] + self.fcn(a[1,*],b[1,*]));
return(fcn(x,y){if(x.len()>y.len())x else y}(lcs(a,b[1,*]),lcs(a[1,*],b)))
}