문제
내 답안
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
vector<int> solution(vector<int> array, vector<vector<int>> commands) {
vector<int> answer, empty;
int start, end, search;
for(int i=0; i < commands.size(); i++){
start = commands[i][0];
end = commands[i][1];
search = commands[i][2];
for(int j = start-1; j <= end-1; j++){
empty.push_back(array[j]);
}
sort(empty.begin(), empty.end(), less<int>());
answer.push_back(empty[search-1]);
cout<<endl;
vector<int>().swap(empty);
}
return answer;
}