목록올바른 괄호 (1)
Try
[Programmers/C++] 올바른 괄호
출처 https://programmers.co.kr/learn/courses/30/lessons/12909 알고리즘 연습 - 올바른 괄호 | 프로그래머스 실행 결과가 여기에 표시됩니다. programmers.co.kr 소스 #include #include #include using namespace std; bool solution(string s) { bool answer = true; stack t; for(int i = 0; i < s.size(); i++){ if(s[i] == '('){ t.push(s[i]); } else if(s[i] == ')'){ if(t.empty()){ return false; } if(t.top() == '('){ t.pop(); } else{ return false..
Algorithm/Programmers
2019. 4. 7. 19:21