leet code valid-parentheses
valid parenthess 풀이 string 의 길이를 돌면서 가장 최근 열린 괄호가 닫힌괄호와 같은지를 판단하고,아니라면 false 를 return 그리고 마무리 까지 진행하다 닫히지 않은 괄호가 존재하면 false 를 리턴하고아니라면 true를 리턴하면 풀이가 끝난다 # Intuition# Approach# Complexity- Time complexity:- Space complexity:# Code```typescript []const types = { '}' : '{', ')' : '(', ']' : '[',}function isValid(s: string): boolean { const temp = []; for (let i = 0; i s.length; i++) { if (typ..
2024.11.13