Would be impressive to solve the general case... find the kth large number: create a minheap of size k, and for each element in the array, if that number is bigger than the top of the minheap, replace the top of the minheap with that number and recreate the minheap. Running time is O(nlgn). If you can have negative numbers, then you can easily modify this code.
int findKthLargestNumber(int[] A, int k)
{
if (k minHeap[2*i+1])
{
int temp = minHeap[i];
minHeap[i] = minHeap[2*i+1];
minHeap[ 2*i+1] = temp;
i = 2*i+1;
}
else if (minHeap.length minHeap[2*i+2)])
{
int temp = minHeap[i];
minHeap[i] = minHeap[2*i+2];
minHeap[ 2*i+2] = temp;
i = 2*i+2;
}
else
{
done = true;
}
}