leetcode Longest Increasing Subsequence 최장 증가 하위 시퀀스

2710 단어 배열
Given [10, 9, 2, 5, 3, 7, 101, 18],
The longest increasing subsequence is [2, 3, 7, 101],
therefore the length is 4. 
there may be more than one LIS combination, 
it is only necessary to return the length.
  :    
    v[6]={523867}
 d[i]   v[i]              ,   1
     i, j 1 i - 1  , v[j] < v[i],
    d[i]    d[j] + 1   ,      d[i]。

     5,          d[0] = 1
     2,          ,d[1] = 1
     32   ,d[2]=max(d[2],d[1]+1)=2
     8,d[3]=max(d[3],d[1]+1)=2,d[3]=max(d[3],d[2]+1)=3
     6,d[4] = 3
     7,d[5] = 4

좋은 웹페이지 즐겨찾기