Question d’entretien chez Ubisoft

Algorithm problem, with an attention to memory complexity.