//优先队列内部堆排序 默认大顶堆 less 小顶堆 greater
//具体操作:https://blog.csdn.net/qq_43625244/article/details/90209149
class Solution {
public:
vector<int> getLeastNumbers_Solution(vector<int> input, int k) {
priority_queue<int>que_;
vector<int>res;
for(auto x:input)
{
que_.push(x);
if(que_.size()>k) que_.pop();
}
while(!que_.empty())
{
res.push_back(que_.top());
que_.pop();
}
reverse(res.begin(),res.end());
return res;
}
};