문제풀이:
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> solution(string my_string) {
vector<int> answer;
for(char c: my_string)
{
if(c>='0' && c<='9')
{
answer.push_back(c-'0');
}
}
sort(answer.begin(),answer.end());
return answer;
}
'코딩테스트' 카테고리의 다른 글
프로그래머스_0단계_공백으로 구분하기 1C++ (0) | 2024.04.11 |
---|---|
프로그래머스_0단계_숨어있는 숫자의 덧셈 (1)C++ (0) | 2024.04.11 |
프로그래머스_0단계_뒤에서 5등까지C++ (0) | 2024.04.11 |
프로그래머스_0단계_0떼기_C++ (0) | 2024.04.11 |
프로그래머스_0단계_가장 큰 수 찾기C++ (0) | 2024.04.11 |