Question d’entretien chez Toptal

Algorithm question, based on leetcode