Pregunta de entrevista de Amazon Web Services

Typical DP and stack-based problem