일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- kaggle
- 파이썬
- Convert Sorted List to Binary Search Tree
- 밴픽
- Python Implementation
- 315. Count of Smaller Numbers After Self
- Python
- 109. Convert Sorted List to Binary Search Tree
- data science
- Python Code
- 30. Substring with Concatenation of All Words
- t1
- concurrency
- Class
- iterator
- 715. Range Module
- Regular Expression
- LeetCode
- Substring with Concatenation of All Words
- 시바견
- shiba
- 컴퓨터의 구조
- 43. Multiply Strings
- Decorator
- 프로그래머스
- Protocol
- Generator
- 운영체제
- DWG
- attribute
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