[leetcode-20] Valid Parenthese
ยท
๐Ÿข One step
LeetCode-20 Valid Parentheses : Given a string s containing just the characters (, ), {, }, [ and ], determine if the input string is valid. note : s consists of parentheses only ()[]{}Answer :::python class Solution: def isValid(self, s: str) -> bool: valid = [] dict_valid = { "}":"{", "]":"[", ")":"(" } for l in s: if l not in dict_valid: valid.append(l) elif not valid or dict_valid[l] != vali..
๋‹คํ–ˆ๋‹ค
'20' ํƒœ๊ทธ์˜ ๊ธ€ ๋ชฉ๋ก