Citadel Interview Question

variation of the quickselect algorithm