Pregunta de entrevista de Goldman Sachs

Dynamic Programming question on strings