Post

[BOJ] 11053. 가장 긴 증가하는 부분 수열(python)

📌문제

Alt text

💪아이디어

Alt text Alt text

🥂코드

1
2
3
4
5
6
7
8
import sys; input = sys.stdin.readline
n = int(input())
arr = list(map(int,input().split()))
dp = [1]*n
for i in range(1,n):
    for j in range(i):
        if arr[j]<arr[i]: dp[i] = max(dp[j]+1,dp[i])
print(max(dp))
This post is licensed under CC BY 4.0 by the author.

Comments powered by Disqus.