c++
#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> temp;
for(int i = 0; i < commands.size(); i++) {
temp.clear();
for(int j = commands[i][0] - 1; j < commands[i][1]; j++) {
temp.push_back(array[j]);
}
cout << endl;
sort(temp.begin(), temp.end());
answer.push_back(temp[commands[i][2] - 1]);
}
return answer;
}
'알고리즘 스터디' 카테고리의 다른 글
[프로그래머스] 해시 2. 전화번호 목록 (0) | 2021.02.03 |
---|---|
[프로그래머스] 정렬 2. 가장 큰 수 (0) | 2021.01.31 |
[프로그래머스] 탐욕법 1. 체육복 (0) | 2021.01.27 |
[프로그래머스] 완전탐색 1. 모의고사 (0) | 2021.01.23 |
[프로그래머스] 해시 1. 완주하지 못한 선수 (0) | 2021.01.20 |