Pregunta de entrevista de Airbnb

Array manipulation, dynamic programming, and reduce time complexity