Yomguithereal / mnemonist

Curated collection of data structures for the JavaScript/TypeScript language.
https://yomguithereal.github.io/mnemonist
MIT License
2.24k stars 92 forks source link

longestCommonSubsequence return wrong result #196

Open JauSingSing opened 1 year ago

JauSingSing commented 1 year ago
var suffixArray = new GeneralizedSuffixArray([
  [1,2,3,4],
  [2,3,4],
  [1,2,3,4]
])
suffixArray.longestCommonSubsequence()
>>> [1,2,3,4]

expect [2, 3, 4]

Yomguithereal commented 1 year ago

Hello @JauSingSing, you are right there is something fishy there. I think I need to rewrite this code to fix those kind of cases and optimize it altogether, I wrote this quite a long time ago.