Question d’entretien chez Windsurf

Leetcode style algorithm question. It was hard.