풀이 (성공)
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
bool compare(int a, int b){
if(a<b){
return true;
}else{
return false;
}
}
vector<int> solution(vector<int> array, vector<vector<int>> commands) {
vector<int> answer;
for(int i=0; i<commands.size(); i++){
vector<int> v;
for(int j=commands[i][0]-1; j<commands[i][1]; j++){
v.push_back(array[j]);
}
int c3 = commands[i][2] -1;
sort(v.begin(), v.end(), compare);
answer.push_back(v[c3]);
}
return answer;
}