웅재의 코딩세상

[프로그래머스] ad 제거하기 본문

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

[프로그래머스] ad 제거하기

웅드 2024. 1. 31. 15:36

 

 

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

using namespace std;

vector<string> solution(vector<string> strArr) {
    vector<string> answer;
    for(int i=0; i<strArr.size(); i++){
        if(strArr[i].find("ad") == string::npos) answer.push_back(strArr[i]);
    }
    return answer;
}
반응형