[프로그래머스][Level1] 문자열 내림차순으로 배치하기 c++
·
🍞 Problem Solving/Programmers
https://programmers.co.kr/learn/courses/30/lessons/12917 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 풀이과정 문자열도 char형이 여러개 이어진 것이기 때문에 sort를 할 수 있다. rbegin()과 rend()는 내림차순을 한다는 것이다. 풀이1 #include #include #include using namespace std; string solution(string s) { string answer = ""; sort(s.rbegin(), s.rend()); answer = s; return ans..