일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 30. Substring with Concatenation of All Words
- t1
- iterator
- 315. Count of Smaller Numbers After Self
- 43. Multiply Strings
- Python Implementation
- Regular Expression
- 프로그래머스
- shiba
- concurrency
- 시바견
- Python
- attribute
- 109. Convert Sorted List to Binary Search Tree
- 715. Range Module
- DWG
- Substring with Concatenation of All Words
- Class
- Generator
- Protocol
- LeetCode
- Convert Sorted List to Binary Search Tree
- 운영체제
- 컴퓨터의 구조
- 밴픽
- kaggle
- Decorator
- Python Code
- 파이썬
- data science
Archives
- Today
- Total
Scribbling
프로그래머스: 정수 삼각형 본문
굉장히 전형적인 DP 문제
def solution(triangle):
h = len(triangle)
dp = [[] for _ in range(h)]
dp[0].append(triangle[0][0])
for i in range(1, h):
dp[i].append(dp[i-1][0] + triangle[i][0])
for j in range(1, i):
dp[i].append(max(dp[i-1][j-1], dp[i-1][j]) + triangle[i][j])
dp[i].append(dp[i-1][-1] + triangle[i][-1])
return max(dp[h-1])
'Computer Science > Coding Test' 카테고리의 다른 글
프로그래머스: 도둑질 (0) | 2021.10.26 |
---|---|
프로그래머스: 등굣길 (0) | 2021.10.26 |
프로그래머스: N으로 표현 (0) | 2021.10.25 |
LeetCode: 106. Construct Binary Tree from Inorder and Postorder Traversal (0) | 2021.10.21 |
프로그래머스: 단속카메라 (0) | 2021.10.21 |