Longest palindromic substrings: Difference between revisions

Content added Content deleted
Line 11: Line 11:
===Manacher Function===
===Manacher Function===
<lang fsharp>
<lang fsharp>
// Mahacher Function. Nigel Galloway: October 1st., 2020
// Manacher Function. Nigel Galloway: October 1st., 2020
let Manacher(s:string) = let oddP,evenP=Array.zeroCreate s.Length,Array.zeroCreate s.Length
let Manacher(s:string) = let oddP,evenP=Array.zeroCreate s.Length,Array.zeroCreate s.Length
let rec fN i g e (l:int[])=match g>=0 && e<s.Length && s.[g]=s.[e] with true->l.[i]<-l.[i]+1; fN i (g-1) (e+1) l |_->()
let rec fN i g e (l:int[])=match g>=0 && e<s.Length && s.[g]=s.[e] with true->l.[i]<-l.[i]+1; fN i (g-1) (e+1) l |_->()
Line 26: Line 26:
(fGo 0 -1 0,fGe 0 -1 0)
(fGo 0 -1 0,fGe 0 -1 0)
</lang>
</lang>

===The Task===
===The Task===
<lang fsharp>
<lang fsharp>