Find the Median as a Job Interview Question

I stumbled across a blog post about finding the median of a list of numbers as a job interview question.

This is the kind of question, and analysis of the question, that the Daily Coding Problem book completely whiffed on. The author of the blog post gives a list of nine things that the simple problem of finding the median has going for it, including places for discussion, how the candidate might respond, noting that the problem is readily testable. I do think that some of the more garbage Daily Coding Problem problems were unsuitable because they didn’t let a candidate write much more than a for-loop, or demonstrate nothing more than having memorized some bitwise tricks. I had never considered finding the median of a list of numbers as a good interview problem, but it looks like it is. It’s also probably true that the author of the post about finding medians has thought out the whole interview coding problem thing, and possibly could turn even a bad coding problem into a good interview.

I think Lobste.rs comments were too harsh. The author of the blog post may not have asked for a linear time median finder, but that’s not what the interviewer is after, and the nine point list shows it. The blog post was a guide for interviewers. The author chose the problem to have an off-by-one pitfall, easy testing, and the possibility of seeing a candidate do simple debugging.

As far as quickselect goes, I found another blog post from a different author about that.