로딩
요청 처리 중입니다...

JAVA_Valid Parentheses_LeetCode 20

 JAVA_Valid Parentheses_LeetCode 20

JAVA_Valid Parentheses_LeetCode 20 Valid Parentheses 풀이 class Solution { public boolean isValid(String s) { HashMap map = new HashMap(); map.put('(',')'); map.put('[',']'); map.put('{','}'); Stack stack = new Stack(); for(char c : s.toCharArray()){ if(c == '(' || c == '{' || c == '['){ stack.push(c); }else{ if(stack.isEmpty()){ return false; } if(map.get(stack.pop()).equals(c)){ continue; }else{ return false; } } } return stack.isEmpty(); } } * 출처 Level up your coding skills and qui...

# JAVA # JAVA_LeetCode20 # JAVA_ValidParentheses # JAVA_ValidParentheses_LeetCode20 # ValidParentheses_LeetCode20