Skip to content

Commit cd56dc8

Browse files
committed
65차 3번 문제풀이
1 parent 2abbb3b commit cd56dc8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

live6/test65/문제3/황장현.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
function solution(s) {
2+
const stack = [];
3+
4+
for (let i = 0; i < s.length; i++) {
5+
if (stack[stack.length - 1] === s[i]) {
6+
stack.pop();
7+
} else {
8+
stack.push(s[i]);
9+
}
10+
}
11+
12+
return !stack.length ? 1 : 0;
13+
}
14+
15+
console.log(solution('baabaa'));

0 commit comments

Comments
 (0)