Skip to content

Commit f4bc768

Browse files
committed
햄버거 만들기 / 중급
1 parent 420da51 commit f4bc768

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(ingredient) {
2+
const q = [];
3+
let count = 0;
4+
5+
for (const item of ingredient) {
6+
q.push(item);
7+
8+
if (q.length >= 4 && q.slice(-4).join("") === "1231") {
9+
q.splice(-4);
10+
count++;
11+
}
12+
}
13+
14+
return count;
15+
}

0 commit comments

Comments
 (0)