use find kth order stats

simpler code than binary search