class Solution {
boolean solution(String s) {
int count = 0;
for (int i = 0; i < s.length(); i++) {
count += (s.charAt(i) == '(') ? 1 : -1;
if (count < 0) break;
}
return count == 0;
}
}
출처: 프로그래머스 코딩 테스트 연습, https://programmers.co.kr/learn/challenges