Question d’entretien chez IBM

Magic Carpet question that was easy Leetcode question.