Skip to content

Commit d0819a1

Browse files
committed
카드 뭉치 / 중급
1 parent a358d28 commit d0819a1

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
function solution(cards1, cards2, goal) {
2+
const q1 = [...cards1];
3+
const q2 = [...cards2];
4+
5+
for (const word of goal) {
6+
if (q1.length > 0 && q1[0] === word) {
7+
q1.shift();
8+
} else if (q2.length > 0 && q2[0] === word) {
9+
q2.shift();
10+
} else {
11+
return "No";
12+
}
13+
}
14+
return "Yes";
15+
}

0 commit comments

Comments
 (0)