| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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
- t1
- kaggle
- 운영체제
- shiba
- 43. Multiply Strings
- Python
- Convert Sorted List to Binary Search Tree
- DWG
- Regular Expression
- iterator
- 시바견
- Python Implementation
- Generator
- 315. Count of Smaller Numbers After Self
- 프로그래머스
- Class
- 밴픽
- Decorator
- LeetCode
- Protocol
- 컴퓨터의 구조
- 파이썬
- attribute
- data science
- 109. Convert Sorted List to Binary Search Tree
- concurrency
- 30. Substring with Concatenation of All Words
- Python Code
- 715. Range Module
- Substring with Concatenation of All Words
Archives
- Today
- Total
Scribbling
LeetCode: 22. Generate Parentheses 본문
class Solution:
def generateParenthesis(self, n: int) -> List[str]:
self.ret = []
self.helper(n, n, '')
return self.ret
def helper(self, l, r, path):
if l == 0:
self.ret.append(path + (')' * r))
return
if l == r:
self.helper(l-1, r, path + '(')
else:
self.helper(l-1, r, path + '(')
self.helper(l, r-1, path + ')')'Computer Science > Coding Test' 카테고리의 다른 글
| LeetCode: 24. Swap Nodes in Pairs (0) | 2021.08.26 |
|---|---|
| LeetCode: 25. Reverse Nodes in k-Group (0) | 2021.08.25 |
| LeetCode: 19. Remove Nth Node From End of List (0) | 2021.08.22 |
| LeetCode: 18. 4Sum (0) | 2021.08.22 |
| LeetCode: 17. Letter Combinations of a Phone Number (0) | 2021.08.21 |