1N = int(input())
2L = list(map(int, input().split()))
3dp = [0]*N
4
5for i in range(1, N):
6 for j in range(i):
7 if L[j]<L[i] and dp[i]<dp[j]+1:
8 dp[i] = dp[j]+1
9print(max(dp)+1)
- LIS를 구하는 문제이다
1N = int(input())
2L = list(map(int, input().split()))
3dp = [0]*N
4
5for i in range(1, N):
6 for j in range(i):
7 if L[j]<L[i] and dp[i]<dp[j]+1:
8 dp[i] = dp[j]+1
9print(max(dp)+1)