※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.37.207.49 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/talk/M.1713367397.A.B09.html
Generation pattern for palindrome
General cases:
S -> aSa
Base case:
S = ""
or
S = c, where c is any single valid character
------------------------------------------------
Checking pattern for palindrone
DP[left, right] = (s[left] == s[right]) and DP[left+1, right-1]
DP[left, right] = 1 if left >= right
回文貓貓
檢查貓貓
字串演算法貓貓
鏡像貓貓
上海自來水來自海上 貓貓~
--