프로그래머스 181900 글자 지우기

1 개요[ | ]

프로그래머스 181900 글자 지우기

2 C++[ | ]

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

using namespace std;

string solution(string my_string, vector<int> indices) {
    sort(indices.begin(), indices.end(), [](int a, int b) -> bool { return a>b;});
    for(int i; i<indices.size(); i++) {
        my_string = my_string.substr(0,indices[i]) + my_string.substr(indices[i]+1);
    }
    return my_string;
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}