Files
rose-ash/lib
giles f9371e7d22
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 21s
ocaml: phase 5.1 lps_dp.ml baseline (LPS "BBABCBCAB" = 7)
Standard O(n^2) length-major DP for longest palindromic
subsequence:

  dp[i][j] = dp[i+1][j-1] + 2                if s[i] = s[j]
           = max(dp[i+1][j], dp[i][j-1])     otherwise

  lps "BBABCBCAB" = 7   (witness "BABCBAB" etc.)

Complementary to manacher.ml (longest palindromic *substring*,
also length 7 on that input by coincidence) — this is the
subsequence variant which doesn't require contiguity.

Tests length-major fill order, inline if for the length-2 base
case, double-nested for with derived j = i + len - 1.

177 baseline programs total.
2026-05-11 01:32:41 +00:00
..