0
내 코드를 추적 긴 일반적인 서브는 LCS의 길이를 계산 작동하지만 다음 링크상의 LCS를 읽기 위해이동 : 다시
http://en.wikipedia.org/wiki/Longest_common_subsequence_problem
을 동일한 코드를 적용하지만 일부 문자열이 누락 . 제가 누락 된 부분을 말씀해 주시겠습니까?
구글 놀이터 링크 : 미리 http://play.golang.org/p/qnIWQqzAf5
func Back(table [][]int, str1, str2 string, i, j int) string {
if i == 0 || j == 0 {
return ""
} else if str1[i] == str2[j] {
return Back(table, str1, str2, i-1, j-1) + string(str1[i])
} else {
if table[i][j-1] > table[i-1][j] {
return Back(table, str1, str2, i, j-1)
} else {
return Back(table, str1, str2, i-1, j)
}
}
}
감사합니다.