题解 | #最长上升子序列(一)#
最长上升子序列(一)
https://www.nowcoder.com/practice/5f65ccbb025240bd8458eb6479c2612e?tpId=308&tqId=2357994&ru=/exam/oj&qru=/ta/algorithm-start/question-ranking&sourceUrl=%2Fexam%2Foj%3Fpage%3D1%26tab%3D%25E7%25AE%2597%25E6%25B3%2595%25E7%25AF%2587%26topicId%3D308
import sys n = int(input()) arr = list(map(int,input().split()) ) dp = [1 for i in range(len(arr))] for i in range(len(arr)): for j in range(i): if arr[j]<arr[i]: dp[i]=max(dp[j]+1,dp[i]) print(max(dp))