Pregunta de entrevista de Palantir Technologies

Dynamic programming questions, complexity of algorithm