Question d’entretien chez Thumbtack

Typical algorithm question