프로그래머스 42748 K번째수

1 개요[ | ]

프로그래머스 42748 K번째수

2 C++[ | ]

#include <string>
#include <vector>
#include <algorithm>
using namespace std;

vector<int> solution(vector<int> array, vector<vector<int>> commands) {
    vector<int> answer;
    for(const auto& c: commands) {
        vector<int> v = vector<int>(array.begin()+(c[0]-1), array.begin()+(c[1]));
        sort(v.begin(), v.end());
        answer.push_back(v[c[2]-1]);
    }
    return answer;
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}