#include <string> #include <vector> #include <algorithm> using namespace std; bool cmp(char a, char b) { if(a <= b) { return false; } else { return true; } } string solution(string s) { // sort(s.begin(), s.end(), greater<char>()); sort(s.begin(), s.end(), cmp); return s; } | cs |
'Programmers > Level 1' 카테고리의 다른 글
[프로그래머스 1] 서울에서 김서방 찾기 (C/C++) (0) | 2019.10.17 |
---|---|
[프로그래머스 1] 문자열 다루기 기본 (C/C++) (0) | 2019.10.17 |
[프로그래머스 1] 문자열 내 p와 y의 개수 (C/C++) (0) | 2019.10.17 |
[프로그래머스 1] 문자열 내 마음대로 정렬하기 (C/C++) (0) | 2019.10.17 |
[프로그래머스 1] 두 정수 사이의 합 (C/C++) (0) | 2019.10.17 |