์‹ค๋ฒ„2 : ๋™์ ๊ณ„ํš๋ฒ• ๋ฌธ์ œ์ด๋‹ค.

ํ’€์ด

๊ธฐ๋ณธ์ ์ธ ๋™์ ๊ณ„ํš๋ฒ• ๋ฌธ์ œ์ด๋‹ค.

Code

import sys
 
input = sys.stdin.readline
 
n = int(input())
a = [0] + list(map(int, input().split()))
dp = [1 for _ in range(n + 1)]
 
for i in range(1, n + 1):
    for j in range(1, i):
        if a[j] < a[i]:
            dp[i] = max(dp[i], dp[j] + 1)
 
print(max(dp))

Reference