Skip to content

Commit

Permalink
이슈 #411에서 솔루션 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Dec 2, 2024
1 parent 8996037 commit 1c23b52
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Programmers/K번째수.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#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> command : commands) {
vector<int> list(array.begin() + command[0] - 1, array.begin() + command[1]);
sort(list.begin(), list.end());
answer.push_back(list[command[2] - 1]);
}

return answer;
}

0 comments on commit 1c23b52

Please sign in to comment.