Pregunta de entrevista de LINE

Using javascript search max profit by the problem input