Question

Complete the recurrence relation for dp[i][j] in the Longest Common Subsequence (LC

  • S problem when text1[i-1] is *not equal* to text2[j-1]. # dp[i][j] stores the length of LCS for text1[:i] and text2[:j] if text1[i-1] == text2[j-1]:     dp[i][j] = 1 + dp[i-1][j-1] else:     dp[i][j] = _________ # Line to complete
A dp[i-1][j-1]
B max(dp[i-1][j], dp[i][j-1])
C min(dp[i-1][j], dp[i][j-1])
D dp[i-1][j] + dp[i][j-1]
Practice Next

Hey! Ask a query