Question d’entretien chez Microsoft

Write and explain an algorithm in a language that you choose.