An interview algorithm question.