Domanda di colloquio di Uber

Programming question involving maximizing profit