Also called LCS and Longest common subsequence, by dynamic programming.
fresh numbers
The test's questions that a run answers, asked again on new numbers whenever you like. The answer, its working and the reason for every other choice come from longest common subsequence's own run on the numbers shown.
choose one
1question 1
How many cells does the method fill to compare stone and notes?
the answer, and why
the answer is C
5 rows of 5 cells, a row for each letter of stone. The first row and column are written at the start.
if you chose another
AThat counts the first row and column too, which are written at the start, not filled.
BThat is the longest common subsequence, such as t and e.
DThat adds the letters, but each row fills a cell for each letter of notes.
How many letters do lemon and melon share in the same order, at most?
the answer, and why
the answer is A
Such as l, o and n, or e, o and n. Could they share 4? Leave one letter out of each word: lemon gives emon, lmon, leon, lemn and lemo, and melon gives elon, mlon, meon, meln and melo. None match.
if you chose another
BThey have the same 5 letters, but not in the same order.
CThat is o and n, the longest run side by side. The letters may have gaps, such as e, o and n.