문제접근🤔


놓쳤던 부분😅


코드😁


4040 KB

0.01 ms

#include <string>
#include <vector>
#include <algorithm>
#include <iostream>

using namespace std;

vector<int> solution(vector<int> array, vector<vector<int>> commands) {
    vector<int> answer;
    vector<int> tmp;
    
    for (int i = 0; i < commands.size(); i++)
    {
        for (int j = commands[i][0] - 1; j < commands[i][1]; j++)
        {
            tmp.push_back(array[j]);
        }
        sort(tmp.begin(), tmp.end());
        answer.push_back(tmp[commands[i][2] - 1]);
        tmp.clear();
    }
    return answer;
}