我们的教授给了我们以下问题: Input
A sequence of characters X = x1, x2, ... ,xn
Output
The length of the longest sub-sequence of X that is a palindrome
我的解决办法是: Take X and reverse it into the sequence
假设我有一个大字符串和一个子字符串数组,当它们与大字符串相等时(差别很小)。 例如(注意字符串之间的细微差别): large_str = "hello, this is a long string, that may be made up of multiple
substrings that approximately match the original string"
sub_strs
我想在榆树中制作一个高效版本的LCS算法。 我喜欢这个ocaml版本,但它使用副作用来缓存结果。 let lcs xs ys =
let cache = Hashtbl.create 16 in
let rec lcs xs ys =
try Hashtbl.find cache (xs, ys) with
| Not_found ->
let