프로그래머스 12915 문자열 내 마음대로 정렬하기

1 개요[ | ]

프로그래머스 12915 문자열 내 마음대로 정렬하기

2 C++[ | ]

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

vector<string> solution(vector<string> strings, int n) {
    sort(strings.begin(), strings.end(), [n](const string& a, const string& b){
        if(a[n] == b[n]) return a < b;
        return a[n] < b[n];
    });
    return strings;
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}