Pregunta de entrevista de Google

Greedy Approach question that is in leetcode.