Domanda di colloquio di Yelp

Asked one algorithm question and solve it with backtracking.