본문 바로가기
[프로그래머스 C++]/LEVEL 1

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

by AKI(JUNI) 2025. 4. 7.

◈ 문제 설명


◈ 문제 설명 링크

코딩테스트 연습 - 문자열 내림차순으로 배치하기 | 프로그래머스 스쿨

 

프로그래머스

SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프

programmers.co.kr

 


◈ 작성 코드

#include <string>
#include <vector>
#include <algorithm>

using namespace std;

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