웅재의 코딩세상

[프로그래머스] 배열 만들기 5 본문

코딩테스트/프로그래머스 - LV 0

[프로그래머스] 배열 만들기 5

웅드 2024. 1. 30. 16:10

 

 

  • 풀이
#include <string>
#include <vector>

using namespace std;

vector<int> solution(vector<string> intStrs, int k, int s, int l) {
    vector<int> answer;
    for(int i=0; i<intStrs.size(); i++){
        string ss = intStrs[i].substr(s,l);
        if(stoi(ss) > k) answer.push_back(stoi(ss));
    }
    return answer;
}
반응형