웅재의 코딩세상

[프로그래머스] 순서 바꾸기 본문

코딩테스트/프로그래머스 - LV 0

[프로그래머스] 순서 바꾸기

웅드 2024. 1. 25. 17:32

 

 

  • 풀이
#include <string>
#include <vector>

using namespace std;

vector<int> solution(vector<int> num_list, int n) {
    vector<int> answer;
    for(int i=n; i<num_list.size(); i++){
        answer.push_back(num_list[i]);
    }
    for(int i=0; i<n; i++){
        answer.push_back(num_list[i]);
    }
    return answer;
}
반응형