The next “Data Structures and Algorithms” lesson will be about Longest Increasing Subsequence (LIS for short) of a sequence. For better understanding, Nam decided to learn it a few days before the les
思路 动态规划,定义状态 d p [ i ] dp[i] dp[i]代表以 n u m s [ i ] nums[i] nums[i]结尾的最长递增子序列的长度,这样的话 d p [ i ] dp[i] dp[i]和其子问题 d p [ k ] , 0 < = k < i dp[k],0<=k<i dp[k],0<=k<i便产生了联系、 状态转移方程 d p [ i ] = m a x ( d