Pregunta de entrevista de Amazon

They asked a coding question about two pointers and dynamic programming