웅재의 코딩세상
[프로그래머스] 카드 뭉치 본문
- 풀이
#include <string>
#include <vector>
using namespace std;
string solution(vector<string> cards1, vector<string> cards2, vector<string> goal) {
string answer = "";
int i=0,j=0;
while(i+j < goal.size()){
if (i < cards1.size() && cards1[i] == goal[i + j])
i++;
else if (j < cards2.size() && cards2[j] == goal[i + j])
j++;
else return "No";
}
return "Yes";
}
반응형
'코딩테스트 > 프로그래머스 - LV 1' 카테고리의 다른 글
[프로그래머스] 2016년 (0) | 2024.02.15 |
---|---|
[프로그래머스] 추억 점수 (0) | 2024.02.14 |
[프로그래머스] 두 개 뽑아서 더하기 (0) | 2024.02.14 |
[프로그래머스] 콜라 문제 (1) | 2024.02.14 |
[프로그래머스] 최소직사각형 (0) | 2024.02.14 |