#include <string>
#include <vector>
using namespace std;
vector<int> solution(vector<int> array, vector<vector<int>> commands) {
vector<int> answer;
for(int i=0;i<commands.size();i++){
int stArt = commands[i][0]-1;
int enD = commands[i][1]-1;
int waNt = commands[i][2]-1;
vector<int> Sort(101);
for(int i=0;stArt<=enD;i++,stArt++){
Sort[i] = array[stArt];
for(int j=i;j>0;j--){
if(Sort[j]>Sort[j-1])
break;
int k=Sort[j];
Sort[j] = Sort[j-1];
Sort[j-1] = k;
}
}
answer.push_back(Sort[waNt]);
}
return answer;
}
top of page
실제 작동 상태를 확인하려면 라이브 사이트로 이동하세요.
K번째수
K번째수
댓글 0개
좋아요
댓글(0)
bottom of page