Atlassian Interview Question

Somewhat similar to "Find Kth smallest element"