Point72 interview question

Solve a greedy algorithm coding question.