https://school.programmers.co.kr/learn/courses/30/lessons/159994
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
#include <string>
#include <vector>
using namespace std;
string solution(vector<string> cards1, vector<string> cards2, vector<string> goal) {
string answer = "Yes";
int idx1 = 0, idx2 = 0;
for (int i = 0; i < goal.size(); ++i){
if (idx1 < cards1.size() && cards1[idx1] == goal[i]){
++idx1;
}
else if (idx2 < cards2.size() && cards2[idx2] == goal[i]){
++idx2;
}
else{
return "No";
}
}
return answer;
}
'프로그래머스 문제풀이 > LEVEL 1' 카테고리의 다른 글
[C++] 프로그래머스 문제풀이 LEVEL 1 소수 찾기 (0) | 2023.07.03 |
---|---|
[C++] 프로그래머스 문제풀이 LEVEL 1 소수 만들기 (0) | 2023.07.03 |
[C++] 프로그래머스 문제풀이 LEVEL 1 모의고사 (0) | 2023.07.03 |
[C++] 프로그래머스 문제풀이 LEVEL 1 과일 장수 (0) | 2023.07.03 |
[C++] 프로그래머스 문제풀이 LEVEL 1 명예의 전당(1) (0) | 2023.07.02 |