LINE interview question

Using javascript search max profit by the problem input