Ancestry Interview Question

Dynamic programming problem related to strings