| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
Tags
- 715. Range Module
- 파이썬
- Generator
- t1
- 밴픽
- 30. Substring with Concatenation of All Words
- shiba
- Python Implementation
- LeetCode
- data science
- Decorator
- 운영체제
- Convert Sorted List to Binary Search Tree
- concurrency
- 43. Multiply Strings
- kaggle
- Class
- iterator
- 시바견
- Python Code
- Substring with Concatenation of All Words
- 컴퓨터의 구조
- 프로그래머스
- Protocol
- DWG
- Python
- Regular Expression
- 315. Count of Smaller Numbers After Self
- 109. Convert Sorted List to Binary Search Tree
- attribute
Archives
- Today
- Total
Scribbling
LeetCode: 96. Unique Binary Search Trees 본문
Computer Science/Coding Test
LeetCode: 96. Unique Binary Search Trees
focalpoint 2021. 10. 13. 20:58class Solution:
def numTrees(self, n: int) -> int:
dp = [0] * (n+1)
dp[0] = 1
dp[1] = 1
for i in range(2, n+1):
count = 0
for j in range(1, i+1):
count += dp[j-1] * dp[i-j]
dp[i] = count
return dp[n]'Computer Science > Coding Test' 카테고리의 다른 글
| 프로그래머스: 주식 가격 (0) | 2021.10.16 |
|---|---|
| 프로그래머스: 다리를 지나는 트럭 (0) | 2021.10.15 |
| LeetCode: 95. Unique Binary Search Trees II (0) | 2021.10.13 |
| LeetCode: 92. Reverse Linked List II (0) | 2021.10.12 |
| LeetCode: 97. Interleaving String (0) | 2021.10.11 |