Skip to content

Commit f62f3f2

Browse files
committed
카드 뭉치 / 중급
1 parent 723e510 commit f62f3f2

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

yulrang/03_Queue/05_Card_queue.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
function solution(cards1, cards2, goal) {
2+
var answer = '';
3+
4+
for(let i=0; i<goal.length; i++) {
5+
if(cards1[0] === goal[i] || cards2[0] === goal[i]){
6+
if(cards1[0] === goal[i]){
7+
cards1.shift();
8+
}
9+
if(cards2[0] === goal[i]){
10+
cards2.shift();
11+
}
12+
answer = "Yes";
13+
} else {
14+
answer = "No";
15+
break;
16+
}
17+
}
18+
19+
return answer;
20+
}

0 commit comments

Comments
 (0)