본문 바로가기
C++

[프로그래머스] 문자열 정렬하기 (1)

by 띰쥬 2025. 9. 5.
728x90
반응형
SMALL

#include <string>
#include <vector>
#include <algorithm>

using namespace std;

vector<int> solution(string my_string) {
    vector<int> answer;
    
    for(char str : my_string){
        if(str >= '0' && str <='9')
            answer.push_back(int(str)-'0');
    }
    sort(answer.begin(),answer.end());
    
    return answer;
}

728x90
반응형
LIST

댓글