public int findKthLargest(int[] nums, int k) {
        int begin = 0, end = nums.length - 1;
        while (true) {
            int pos = partition(nums, begin, end);
            if (pos == k - 1)
                return nums[pos];
            if (pos > k - 1)
                end = pos - 1;
            else
                begin = pos + 1;
        }
    }