DP World Interview Question

DP problem based on a variation of LCS