Pregunta de entrevista de Coupang

coding question was related to dynamic programming