A solution to an interview question on combinatorics