프로그래머스 181864 문자열 바꿔서 찾기

1 개요[ | ]

프로그래머스 181864 문자열 바꿔서 찾기

2 C++[ | ]

#include <string>
#include <vector>

using namespace std;

int solution(string myString, string pat) {
    for(char& ch: myString) {
        ch = (ch == 'A') ? 'B' : 'A';
    }
    return myString.find(pat) != string::npos;
}
#include <string>
#include <vector>

using namespace std;

int solution(string myString, string pat) {
    for(char& ch: myString) {
        if(ch == 'A') {
            ch = 'B';
        } else {
            ch = 'A';
        }
    }
    return myString.find(pat) != string::npos;
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}