思路
先排序,再删除input[k - 1]以后的元素,返回input向量
class Solution {
public:
vector<int> getLeastNumbers_Solution(vector<int> input, int k) {
sort(input.begin(),input.end());
input.erase(input.begin() + k,input.end());
return input;
}
};