diff --git "a/leetcode3/\354\235\264\354\247\204\355\235\254/20. Valid Parentheses.java" "b/leetcode3/\354\235\264\354\247\204\355\235\254/20. Valid Parentheses.java" new file mode 100644 index 00000000..1f1f9999 --- /dev/null +++ "b/leetcode3/\354\235\264\354\247\204\355\235\254/20. Valid Parentheses.java" @@ -0,0 +1,40 @@ +/* + +1. 아이디어 : stack 구조 성질 활용 + push, pop을 하며 괄호가 올바르게 배치됐는지 체크 + +2. 시간복잡도 : O(N) + +3. 자료구조/알고리즘 : stack + + */ + +class Solution { + public boolean isValid(String s) { + // stack 구조 활용 + + Deque stack = new ArrayDeque<>(); + + for(int i=0; i