public int findKthLargest(int[] nums, int k) {
        if (nums == null) return -1;
        int low = 0, high = nums.length - 1;
        while (low <= high) {
            int p = partition(nums, low, high);
            if (p == k - 1) return nums[p];
            else if (p < k - 1) low = p + 1;
            else high = p - 1;
        }
        return -1;
    }