프로그래머스(Programmers)

Level 1 > 문자열 내림차순으로 배치하기

cepiloth 2018. 8. 8. 15:41
반응형

https://programmers.co.kr/learn/courses/30/lessons/12917


1. 문제


2. 알고리즘

키워드 - 구현, 정렬


3. 코드


1
2
3
4
5
6
7
8
9
10
11
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
 
using namespace std;
 
string solution(string s) {
    sort(s.begin(), s.end(), greater<char>());
    return s;
}
cs

반응형