Question d’entretien chez Uber

Pretty simple dynamic programming question