Gamified challenge · 2-D dynamic programming
A subsequence keeps some bases of a strand in their original order, possibly with gaps: GTA is a subsequence of GATTACA. A common gene is a subsequence of both strands.
Write lcs(a, b) that returns the length of the longest common gene of strands a and b. For GATTACA and TACGATA the answer is 4 (for example GATA).
Strands use the letters A, C, G, T, are at most 16 bases long, and may be empty (the answer is then 0).
This game is part of the paid plans. Sign in, then pick a plan to write your answer, watch it play out, and step through the algorithm with its guide.
Sign in with Google