Pergunta de entrevista da empresa Amazon

Technical question was Greedy minimization problem