작성
·
224
0
function solution(s){
let stack = []
let leng = stack.length
for (i=0; i<s.length; i++){
stack.push(s[i])
if (stack[leng-2]+stack[leng-1] === '()'){
stack.pop()
stack.pop()
}
}
if (leng === 0){
return 'YES'
} else {
return 'NO'
}
}
let a="(()(()))(()()()))(";
console.log(solution(a));