전체 글 (454) 썸네일형 리스트형 [Level 1][C++] 문자열 내림차순으로 배치하기 풀이1#include #include #include using namespace std;string solution(string s) { char * arr = new char[s.length()+1]; strcpy(arr, s.c_str()); for(int i=0; i 풀이2#include #include #include using namespace std;string solution(string s) { sort(s.begin(), s.end(), greater()); return s;} sort함수3번째 인자를 넣지 않으면 default로 오름차순으로 정렬한다. 반환형은 void.- sort(arr, arr+n)- sort(arr.begin.. [Level 1][C++] 서울에서 김서방 찾기 #include #include using namespace std;string solution(vector seoul) { int idx; for(int i=0; i [Level 1][C++] 수박수박수박수박수박수? #include #include using namespace std;string solution(int n) { string answer = ""; for(int i=0; i 이전 1 ··· 15 16 17 18 19 20 21 ··· 152 다음