#include <bits/stdc++.h>

class Solution {
public:
    int findKth(vector<int> a, int n, int K) {
        // write code here
        priority_queue<int> mq;

        for(int i = 0; i<n; ++i)
        {
            mq.push(a[i]);
        }

        int t;
        for(int i=0; i<K; i++)
        {
            t = mq.top();

            mq.pop();

            
        }

        return t;
    }
};

利用了堆 空间O(n) 时间O(n)