Pregunta de entrevista de Epic Games

Basic dynamic programming question, string question