In addition to the points listed, it gives the algorithm nerds the opportunity to show their overqualification by whipping out the O(n) median algorithm and proving that it works in linear time.
salamanderman•12m ago
I almost tanked an interview, and luckily turned it around, when the interviewer had never heard of QuickSelect and thought I was insane when I started writing it.
joshdavham•15m ago
I also like this question.
A fun follow up is asking a candidate how to compute the 25th and 75th percentiles or more broadly, the n-th percentile.
ukoki•13m ago
Only the median (or pair around the median) needs to be sorted, the other numbers can be unsorted :)
wewewedxfgdf•10m ago
Great question! Assuming the job requires calculating a lot of medians.
apricot•17m ago
salamanderman•12m ago