[프로그래머스] 문자열 내림차순으로 배치하기


연습문제 - 문자열 내림차순으로 배치하기

사용 언어 : Python3

def solution(s):
    answer = ''.join(sorted(s, reverse=True))
    return answer

사용 연어 : C++

#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

bool compare_val(int a, int b){return a > b;}

string solution(string s) {
    string answer = "";
    sort(s.begin(), s.end(), compare_val);
    answer = s;
    return answer;
}


© 2020. by bs-derek