Microsoft Interview Question

Quick sort, and a riddle that could be easily solved using maths.