프로그래머스 문자열 내림차순으로 배치하기
2022. 8. 11. 12:37ㆍ코딩 공부 연습
반응형
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
string solution(string s) {
string answer = "";
vector <int> arr;
for (int i = 0; i < s.size(); i++)
arr.push_back(s[i]);
sort(arr.begin(), arr.end(), greater());
for (int i = 0; i< arr.size(); i++)
answer += arr[i];
return answer;
}
'코딩 공부 연습' 카테고리의 다른 글
프로그래머스 나누어 떨어지는 숫자 배열 (0) | 2022.08.11 |
---|---|
프로그래머스 카펫 (0) | 2022.08.11 |
프로그래머스 같은 숫자는 싫어 (0) | 2022.08.11 |
프로그래머스 시저 암호 (0) | 2022.08.10 |
프로그래머스 서울에서 김서방 찾기 (0) | 2022.08.10 |