> For the complete documentation index, see [llms.txt](https://pyohamen.gitbook.io/til/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pyohamen.gitbook.io/til/algorithm/programmers/undefined-2.md).

# 정수삼각형

> <https://programmers.co.kr/learn/courses/30/lessons/43105>

간단한 DP 문제 DP 의 형태가 삼각2차원 행렬일 뿐

```python
def solution(triangle):
    a = triangle
    n = len(a)
    # d = [[0] * i for i in range(1, n+1)]
    # d[0][0] = a[0][0]

    for i in range(1, n):
        for j in range(i + 1):
            # 맨 왼쪽일 때
            if j == 0:
                a[i][j] += a[i - 1][0]
            elif j == i:
                a[i][j] += a[i - 1][j - 1]
            else:
                a[i][j] += max(a[i - 1][j - 1], a[i - 1][j])

    return max(a[n - 1])
```
