※ 引述《mqazz1 (無法顯示)》之銘言:
: A palindrome is a nonempty string over some alphabet that reads the same
: forward and backward. Examples of palindromes are all strings of length 1,
: civic, racecar, and aibohphobia (fear of palindromes)
: input: A[1...n]
: m[i+1,j-1] + 1 , if A[i] = A[j]
: m[i,j] = max{ m[i,j-1], m[i+1,j] } , if A[i] != A[j]
: 請問這個遞迴式是甚麼意思?
: 謝謝
如果第i個位置和第j個位置文字相同的話,+1分,然後再往第i+1個位置和第j-1個位置比對,內縮進去,
如果不相同的話,那就i和j-1的文字比對,i+1和j的文字比對…然後看哪一個方向分數較高。
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.160.214.182