Question d’entretien chez Microsoft

Require best algorithm both in time and space