RosettaCodeData/Task/Longest-common-subsequence/J/longest-common-subsequence-2.j

4 lines
165 B
Text
Raw Permalink Normal View History

2013-04-10 21:29:02 -07:00
mergeSq=: ;@}: ~.@, {.@;@{. ,&.> 3 {:: 4&{.
common=: 2 2 <@mergeSq@,;.3^:_ [: (<@#&.> i.@$) =/
lcs=: [ {~ 0 {"1 ,&$ #: 0 ({:: (#~ [: (= >./) #@>)) 0 ({:: ,) common