That all depends on what one is actually looking to find in an applicant. If the goal of the question is to actually determine if the interviewee has the ability to research a problem, think it through, and implement the solution, then the "homework" approach is definitely superior.
However, if the thrust of the question is to see the applicant think on his/her feet and possibly apply some knowledge from a college class on algorithms (I never covered a problem in this depth in my undergrad comp sci education, but it's definitely standard to discuss computing order statistics), presenting it in the interview is best. The idea of the solution as presented here could easily be sketched out in the interview, and a skilled interviewer could lead the applicant through fleshing out some details if that was so desired.
That said, I think the latter is more often the goal of a final round interview.
However, if the thrust of the question is to see the applicant think on his/her feet and possibly apply some knowledge from a college class on algorithms (I never covered a problem in this depth in my undergrad comp sci education, but it's definitely standard to discuss computing order statistics), presenting it in the interview is best. The idea of the solution as presented here could easily be sketched out in the interview, and a skilled interviewer could lead the applicant through fleshing out some details if that was so desired.
That said, I think the latter is more often the goal of a final round interview.