Question d’entretien chez Microsoft

A medium difficulty algorithm problem