@@ -0,0 +1,1346 @@
+/**%0A * Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.%0A * For example, given %5B3,2,1,5,6,4%5D and k = 2, return 5.%0A * Note: You may assume k is always valid, 1 %E2%89%A4 k %E2%89%A4 array's length.%0A * @author Jun%0A */%0A%0Apublic class Solution %7B%0A    public int findKthLargest(int%5B%5D nums, int k) %7B%0A    %09if(k %3C 1 %7C%7C nums == null) return 0;%0A    %09// the kth largest element equals the (nums.length-k+1)th smallest element%0A    %09return getKth(nums, nums.length - k + 1, 0, nums.length - 1);%0A    %7D%0A    %0A    // get the kth element in subarray of nums, from start to end.%0A    private int getKth(int%5B%5D nums, int k, int start, int end) %7B%0A    %09int pivot = nums%5Bend%5D;%0A    %09int left = start, right = end;%0A    %09while(left %3C right) %7B%0A    %09%09while(nums%5Bleft%5D %3C pivot && left %3C right)%0A    %09%09%09left++;%0A    %09%09while(nums%5Bright%5D %3E= pivot && left %3C right)%0A    %09%09%09right--;%0A    %09%09swap(nums, left, right);%0A    %09%7D    %09%0A    %09swap(nums, left, end); // pivot is the (left+1)th element in nums%0A    %09%0A    %09if(k == left + 1)%0A    %09%09return pivot;%0A    %09else if(k %3C left + 1)%0A    %09%09return getKth(nums, k, start, left - 1);%0A    %09else%0A    %09%09return getKth(nums, k, left + 1, end);%0A    %7D%0A    %0A    private void swap(int%5B%5D nums, int i, int j)%7B%0A    %09int tmp = nums%5Bi%5D;%0A    %09nums%5Bi%5D = nums%5Bj%5D;%0A    %09nums%5Bj%5D = tmp;%0A    %7D%0A%7D%0A

Create 215.java