#include <string>
#include <vector>
#include<algorithm>
using namespace std;
vector<int> solution(vector<int> array, vector<vector<int>> commands) {
vector<int> answer;
for(vector<int> elem : commands) {
vector<int> temp;
temp.assign(array.begin() + elem[0] - 1, array.begin() + elem[1]);
sort(temp.begin(), temp.end());
answer.push_back(temp[elem[2]-1]);
}
return answer;
}
'알고리즘 > 프로그래머스 문제풀이' 카테고리의 다른 글
[프로그래머스] 기능개발 / C++ (0) | 2020.08.24 |
---|---|
[프로그래머스] 스택,큐 / 다리를 지나는 트럭 (0) | 2020.08.24 |
[프로그래머스] 스택,큐 / 주식가격 (0) | 2020.08.11 |
[프로그래머스] 정렬 / 가장 큰 수 (0) | 2020.08.08 |
[프로그래머스] 해싱 / 위장 (0) | 2020.08.07 |