Question d’entretien chez Uber

Solve this problem given an input and output.