ProgrammingVery hard
The length of the longest common subsequence of "ABCBDAB" and "BDCAB" is what?
- A. 4
- B. 3
- C. 5
- D. 2
Correct answer: A. 4
A longest common subsequence is B, C, A, B (or B, D, A, B), of length 4. The standard 2D table gives the same value.
More C Programming questions
- What is the Levenshtein edit distance between "kitten" and "sitting" (insert, delete, replace, each cost 1)?
- A 5 x 7 int matrix is stored in row-major order. What is the flat offset of the cell at 1-based row 3, column 4?
- On a 4 x 4 grid, a robot moves only right or down from (0,0) to (3,3) and may not enter cell (1,1). How many routes are there?
- Which parameter declaration accepts an int a[3][4] argument from main without a warning?
- On an n x n grid with n = 4, how many cells lie on at least one of the two main diagonals?
- int a[2][2] = {1, 2, 3, 4}; What is a[1][0]?