Question d’entretien chez Google

Medium leetcode question and its complexity analysis.