웅재의 코딩세상

[프로그래머스] 접미사 배열 본문

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

[프로그래머스] 접미사 배열

웅드 2024. 1. 30. 16:02

 

 

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

using namespace std;

vector<string> solution(string my_string) {
    vector<string> answer;
    for(int i=0; i<my_string.size(); i++){
        answer.push_back(my_string.substr(i));
    }
    sort(answer.begin(),answer.end());
    return answer;
}
반응형