일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
Tags
- DWG
- 715. Range Module
- 프로그래머스
- 315. Count of Smaller Numbers After Self
- Substring with Concatenation of All Words
- Convert Sorted List to Binary Search Tree
- Class
- 시바견
- Decorator
- LeetCode
- 43. Multiply Strings
- 파이썬
- shiba
- Python Implementation
- Generator
- Regular Expression
- 운영체제
- data science
- Python Code
- 109. Convert Sorted List to Binary Search Tree
- Protocol
- 밴픽
- t1
- 컴퓨터의 구조
- kaggle
- attribute
- 30. Substring with Concatenation of All Words
- concurrency
- Python
- iterator
Archives
- Today
- Total
목록32. Longest Valid Parentheses (1)
Scribbling
32. Longest Valid Parentheses
무지성 포칼포인트의 답... class Solution: def longestValidParentheses(self, s: str) -> int: if not s: return 0 mem = [0] * len(s) stack = [] length = 0 for i in range(len(s)): char = s[i] if char == '(': stack.append(char) length = 0 else: if not stack: length = 0 else: top = stack.pop() if top == '(': length += 2 if i - length >= 0 and s[i-length] == ')': length += mem[i-length] else: length = 0 mem[i] =..
Computer Science/Coding Test
2021. 9. 4. 00:13