function solution(s){ let stack = [], count = 0 for(let x of s){ if(x==='('){ stack.push(x) count++; } else if (stack.length===0){ return false } else{ stack.pop() count--; } } return count===0 }