#include <queue> #include <vector> class Solution { public: priority_queue<int> q; vector<int> ans; vector<int> GetLeastNumbers_Solution(vector<int> input, int k) { if(k==0) return ans; for(int i=0;i<k;i++) q.push(input[i]); for(int i=k;i<input.size();i++){ q.push(input[i]); q.pop(); } while(!q.empty()){ ans.push_back(q.top()); q.pop(); } return ans; } };