Pregunta de entrevista de Goldman Sachs

Leetcode Hard question, similar to get the maximum score